'DataFrame'对象在我尝试创建新df时不是可调用错误

问题描述 投票:-1回答:1

我尝试从df_exo中创建新的df,但是我得到的错误是'DataFrame' object是不可调用的。 df_exo是具有176, 1222大小的DataFrame。怎么了?

df_features = df_exo(['INDU.NL.INTM.1.BS.M', 'INDU.NL.CONS.1.BS.M_4',\
 'INDU.NL.INTM.2.BS.M', 'INDU.NL.INTM.3.BS.M_12', 'INDU.NL.CONS.4.BS.M_10',\
 'INDU.NL.INTM.COF.BS.M_3', 'INDU.NL.INTM.COF.BS.M_4', 'INDU.NL.INVE.5.BS.M_11',\
 'INDU.NL.FOBE.7.BS.M_4', 'INDU.NL.TOT.1.BS.M_1', 'INDU.NL.TOT.6.BS.M_4',\
 'INDU.NL.INTM.2.BS.M', 'SERV.NL.TOT.2.BS.M', 'SERV.NL.TOT.3.BS.M',\
 'SERV.NL.TOT.1.BS.M_2', 'SERV.NL.TOT.1.BS.M_3', 'SERV.NL.TOT.3.BS.M_1',\ 
 'SERV.NL.TOT.3.BS.M_2', 'SERV.NL.TOT.COF.BS.M_7', 'CONS.NL.TOT.7.BS.M',\
 'CONS.NL.TOT.6.BS.M_12', 'CONS.NL.TOT.7.BS.M_1', 'CONS.NL.TOT.7.BS.M_2',\
 'CONS.NL.TOT.7.BS.M_12', 'BUIL.NL.TOT.3.BS.M_12'])
python dataframe object spyder callable
1个回答
0
投票

使用

df_features = df_exo[['col1', 'col2']]

不是

df_features = df_exo(['col1', 'col2'])

参考:Selecting multiple columns in a pandas dataframe

© www.soinside.com 2019 - 2024. All rights reserved.