小编Car*_*lho的帖子

等效于 Python 中的“qt”R 函数

我在 R 中有以下代码:

n <- 112 # Observations 
p <- 4 # Variables
alpha <- 0.05 # Alpha is alpha 
quant = qt(1-alpha/2, n-p-1) # which is 1.982383
Run Code Online (Sandbox Code Playgroud)

根据我的研究,qtR 中的函数与t 分布有关:R - qt 函数语法

我的问题是:

如何在 Python 中获得等价物?

python statistics r probability scipy

1
推荐指数
1
解决办法
859
查看次数

从列表中获取列表

我有此列表,其内容如下:

quake_list = [{'time': '2016-01-12T21:05:59.000Z',
               'location': {'latitude': 60.5079, 'longitude': -142.9635},
               'event': {'magnitude': 1.3, 'depth': 9.1},
               'type': 'earthquake',
               'status': 'reviewed'},
              {'time': '2016-01-12T21:02:24.760Z',
               'location': {'latitude': 38.7978325, 'longitude': -122.7196655},
               'event': {'magnitude': 1.0, 'depth': -0.77},
               'type': 'earthquake',
               'status': 'automatic'},
               ...]
Run Code Online (Sandbox Code Playgroud)

另一件事,我需要过滤掉None条目看来,文件没有该值的条目。

这就是为什么我收到错误消息

TypeError:列表索引必须是整数或切片,而不是str

我需要为此创建一个列表,其中包含所有值:

magnitude = [1.3,1.0]

谢谢您的帮助。

python dictionary list

-1
推荐指数
1
解决办法
82
查看次数

标签 统计

python ×2

dictionary ×1

list ×1

probability ×1

r ×1

scipy ×1

statistics ×1