import pandas as pd
df1 = pd.DataFrame(data= [[1, 2, 3],[4, 5, 6], [7, 8, 9]], index=[0, 1, 2], columns...label,显然在df2的行的名字中没有叫0的。...print(df2.loc[0])
'''
TypeError: cannot do slice indexing on <class 'pandas.core.indexes.base.Index'...label,显然在df1的列的名字中没有叫0,1和2的。...正确的写法应该如下:
# 也就说,不论index是什么类型的,iloc只能写位置,也就是整型数字。