【发布时间】:2018-10-18 04:31:52
【问题描述】:
当我运行我的脚本时,Pandas 会给出以下信息:“未来警告”
FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
我的脚本:
import io
data = io.StringIO('''A,B,M
AM,1,
AMC,2,
''')
df = pd.read_csv(data)
r=['CAR']
s=['CAR_M']
for i,j in zip(r,s):
df=df.append([{'A':i,'M':j}], ignore_index=True)
如果“ignore_index=False”,也会出现同样的警告。我不知道如何重新索引?
【问题讨论】: