问题详细
我在使用shapiro函数的时候报错:TypeError: 'method' object is not subscriptable。
问题代码:
from scipy.stats import shapiro
shapiro_stat, s_p_value = shapiro(df[arg.col])
if s_p_value > 0.05:
return True
else:
return False
报错如下:
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\xxx\anaconda3\envs\learn\lib\concurrent\futures\process.py", line 246, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "C:\Users\xxx\anaconda3\envs\learn\lib\concurrent\futures\process.py", line 205, in _process_chunk
return [fn(*args) for args in chunk]
File "C:\Users\xxx\anaconda3\envs\learn\lib\concurrent\futures\process.py", line 205, in <listcomp>
return [fn(*args) for args in chunk]
File "D:\Desktop\aaa项目\weight_estimation\2.2.2.原始数据分析验证_局部异步池.py", line 249, in remove_anomalies_day
df_day_details = remove_anomalies(df_day_group,arg)
File "D:\Desktop\aaa项目\weight_estimation\2.2.2.原始数据分析验证_局部异步池.py", line 227, in remove_anomalies
k = binning_k(df, arg)
File "D:\Desktop\aaa项目\weight_estimation\utils2\binning_k.py", line 92, in binning_k
k = auto_k(df,arg)
File "D:\Desktop\aaa项目\weight_estimation\utils2\binning_k.py", line 80, in auto_k
Orthotropic_jude = distribution_test(df, arg)
File "D:\Desktop\aaa项目\weight_estimation\utils2\distribution_tests.py", line 117, in distribution_test
sw_bool = shapiro_wilk_tests(df=df.copy, arg=arg)
File "D:\Desktop\aaa项目\weight_estimation\utils2\distribution_tests.py", line 105, in shapiro_wilk_tests
print(df[arg.col])
TypeError: 'method' object is not subscriptable
"""
我在jupyter上是正常使用的。没有报错。但是在pycharm上却报错。
问题环境
win11
python 3.8
scipy 1.10.0