如何解决我该如何解决使用python中的相关性来减少Excel数据的问题?TypeError:/:“ str”和“ int”
data_a = pd.read_excel("D://thesis//LapGyn4_v1.0//Surgical_Actions//mydata2.xlsx")
data_a
cols1 = data_a.columns
corrList = []
labels = data_a.iloc[:,1200]
a1 = np.corrcoef(data_a.iloc[:,0],labels)
print(a1[0,1])
for i in range(data_a.shape[1]):
a1 = np.corrcoef(data_a.iloc[:,i],labels)
corrList.append(a1[0,1])
a1 = range((1200))
lists = [a1,corrList]
df = pd.concat([pd.Series(x) for x in lists],axis=1)
df.iloc[:,1] = abs(df.iloc[:,1])
df2 = df[df.iloc[:,1]>0.18]
print(df2.shape)
df2.iloc[(df2.shape[0]-1),0] = 1200
allData3 = data_a.iloc[:,df2.iloc[:,0].astype(int)]
allData3.to_csv('D://thesis//LapGyn4_v1.0//Surgical_Actions//reduceddata2.csv',index=False)
这是我的代码,我对此问题有此错误 enter image description here
TypeError:/:'str'和'int'的不受支持的操作数类型
我该如何解决? 我想通过使用与此代码的相关性来进行功能简化,但是我收到此错误: TypeError:/的不支持的操作数类型:“ str”和“ int”
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。