T.Test有两个pandas数据帧

时间:2018-02-01 10:39:20

标签: python pandas scipy statsmodels

我有两个大数据框,如下所示:

DF

           Tumor    Tumor    Tumor    Tumor    Tumor    Tumor    Tumor    Tumor  
gene0      16.8883  119.087   4.5331   6.6198   0.8511   1.7598     8.15   6.7992
gene1       7.9272   0.5438  28.1052  98.4692  31.4894   8.7989    4.075  141.213
gene2       2.7573   3.2626  15.4125   9.1022   7.6596   2.3464     6.52    1.569
gene3       3.1019   2.7189   3.6265  12.8258   5.9574   4.1062  163.814  21.4435
gene4      745.497  1387.71  553.944  541.581  448.511  675.172  764.466  850.941

[139 rows x 1101 columns]

和df2

idx = df.index.intersection(df2.index)
scipy.stats.ttest_ind(df.loc[idx], df2.loc[idx], axis=1)

error: 'Traceback (most recent call last):
  File "data.py", line 75, in <module>
    print(scipy.stats.ttest_ind(Module_1_df_Tumor.loc[idx], Module_1_df_Normal.loc[idx], axis=1))
  File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 4066, in ttest_ind
    df, denom = _equal_var_ttest_denom(v1, n1, v2, n2)
  File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 3884, in _equal_var_ttest_denom
    denom = np.sqrt(svar * (1.0 / n1 + 1.0 / n2))
AttributeError: 'float' object has no attribute 'sqrt'

有人知道如何在Normal和Tumor数据帧之间进行t检验以找出显着差异的基因吗?

我试过

question.no_value = value
question.save()

由于

0 个答案:

没有答案