R的adjboxStats函数的等效Python(numpy,scipy或Pandas)是什么? [英] What is the Python (numpy or scipy or Pandas) equivalent for R's adjboxStats function?

查看:81
本文介绍了R的adjboxStats函数的等效Python(numpy,scipy或Pandas)是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实使用R来获取数据集的离群值,并且在R中使用了此代码段,其工作方式就像广告中所宣传的一样!

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!

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)

我得到以下输出:

$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

这是R和python之间跨语言的版本,它的唯一问题是它将无法继续执行,并且每次运行脚本时都必须终止进程.

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.

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.

有没有办法让它在纯python中工作?

is there's away to get this working in pure python?

谢谢!

推荐答案

当您同时导入rpyrpy2时,挂起似乎发生了.如果您只是这样做:

The hanging appears to happen when you import both rpy and rpy2. 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)

此代码应该有效.

这篇关于R的adjboxStats函数的等效Python(numpy,scipy或Pandas)是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆