简体   繁体   English

R的adjboxStats函数的等效Python(numpy,scipy或Pandas)是什么?

[英]What is the Python (numpy or scipy or Pandas) equivalent for R's adjboxStats function?

I do use R to get the outliers for data set and I do use this snippet in R and it works like it's advertised to! 我确实使用R来获取数据集的离群值,并且确实在R中使用了此代码段,并且它的工作方式就像被宣传为!

library("robustbase")
adjboxStats(c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do.conf = TRUE, do.out = TRUE)

and I get this output: 我得到以下输出:

$stats
[1]    203.900   1834.375  11232.100 133262.800 232223.300

$n
[1] 7

$conf
[1] -67254.84  89719.04

$fence
[1]   -6963.467 5097118.725

$out
[1] 3445532344

this is the versions of across language between R and python, the only issue with it it won't continue the execution and i have to kill the process every-time I run the script. 这是R和python之间跨语言的版本,它的唯一问题是它将无法继续执行,并且每次运行脚本时都必须终止进程。

from rpy import *
r.library("robustbase")
import rpy2.robjects as robjects
r("adjboxStats")(r.c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do_conf = True, do_out = True)

see my previous question was here for more info. 看到我以前的问题在这里获取更多信息。

is there's away to get this working in pure python? 有没有办法让它在纯python中工作?

Thank you! 谢谢!

The hanging appears to happen when you import both rpy and rpy2 . 当您同时导入rpyrpy2时,挂起似乎发生了。 If you just do: 如果您只是这样做:

from rpy import *
r.library("robustbase")
r("adjboxStats")(r.c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do_conf = True, do_out = True)

This code should work. 此代码应该起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM