Python t-test模块问题
我正在熊猫数据帧上使用t-test。 我有大约40个属性和一个目标变量 我使用这段代码进行t检验分析:Python t-test模块问题,python,pandas,stat,Python,Pandas,Stat,我正在熊猫数据帧上使用t-test。 我有大约40个属性和一个目标变量 我使用这段代码进行t检验分析: stats.ttest_ind(df[df['target']==1]['variable'], df[df['target']==0]['variable']) 我还导入了必要的模块: from scipy import stats 然而,我不断地犯这个错误,不确定我做错了什么: AttributeError Traceback (m
stats.ttest_ind(df[df['target']==1]['variable'], df[df['target']==0]['variable'])
我还导入了必要的模块:
from scipy import stats
然而,我不断地犯这个错误,不确定我做错了什么:
AttributeError Traceback (most recent call last)
<ipython-input-187-dbb554ef9ddf> in <module>()
----> 1 stats.ttest_ind(df[df['target']==1]['variable'],
df[df['target']==0]['variable'])
AttributeError: 'function' object has no attribute 'ttest_ind'
AttributeError回溯(最近一次调用)
在()
---->1 stats.ttest_ind(df[df['target']==1]['variable'],
df[df['target']==0]['variable'])
AttributeError:“函数”对象没有属性“ttest\u ind”
有人能为这个问题提出一些解决方案吗?我已经为这个问题工作了几个小时,不知道出了什么问题。试试看
from scipy.stats import ttest_ind
ttest_ind(df[df['target']==1]['variable'], df[df['target']==0]['variable'])
您的代码中是否有一个名为stats的函数
def stats(x):
print(x)
stats.ttest_ind()
AttributeError:“function”对象没有属性“ttest\u ind”谢谢你,这起作用了,我不知道是什么导致了这个问题,因为它最初起作用了。但再一次,谢谢你