python - Pandas 汇总统计的经济状况调查有何不同?

标签 python pandas numpy statistical-test

我希望对两个 DataFrame 的汇总统计数据进行均值测试差异。

df1[['sd']].describe()
                sd
count  5000.000000
mean      0.635558
std       0.086109
min       0.492922
25%       0.577885
50%       0.639906
75%       0.688645
max       0.800767

df2[['sd']].describe()
                sd
count  5000.000000
mean      0.640954
std       0.084459
min       0.496823
25%       0.577373
50%       0.644122
75%       0.693863
max       0.798076

我正在寻找一些函数,我可以调用这些汇总统计数据来告诉我我的均值差异是否具有统计显着性。

最佳答案

如果您观察到来自相同或不同总体的两个独立样本,则对独立样本执行 t 检验。

这是对两个独立样本具有相等平均值的原假设的双侧检验。

from scipy.stats import ttest_ind

ttest_ind(df1['sd'], df2['sd'])

输出将是 t 统计量和 p 值。

关于python - Pandas 汇总统计的经济状况调查有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60495977/

相关文章:

python - Pandas 条形图中的自定义图例 (matplotlib)

python - 重复二维数组的行

python - 带边界的 SQLAlchemy 求和函数

python - 我如何将点击工具与条形图 -bokeh 一起使用

python - Pandas read_csv 大文件将每一列放入一个

python-3.x - Python/Pandas 仅当值不为 0 时才进行减法

python - 为什么我得到 "ufunc ' multiply' did not contain a loop with signature matching types dtype ('S32' ) dtype ('S32' ) dtype ('S32' )"with values from raw_input

python - 在 python 中解压数组

python - Pandas : TypeError: float() argument must be a string or a number

python - 如何检查文件是否从Python中的另一个文件导入