您需要使用index_col=False参数读取文件:
# wrong way:
df = pd.read_csv("IntPayments26102020.csv")
print(df.head())
# result :
Date Travels ... Debt Services And Payments Total
10/12/2003 234234.00 23424.0 ... 3.574570e+05 NaN
1/12/2005 12.00 2.0 ... 1.160000e+02 NaN
4/28/2006 7119901.48 9950000.0 ... 3.887479e+08 NaN
5/2/2006 346.00 345435.0 ... 4.632060e+05 NaN
5/12/2006 152204.22 11500000.0 ... 4.743224e+08 NaN
[5 rows x 11 columns]
# correct way:
df = pd.read_csv("IntPayments26102020.csv", index_col=False)
print(df.head())
# result :
Date Travels ... Debt Services And Payments Total
0 10/12/2003 234234.00 ... 23423.00 3.574570e+05
1 1/12/2005 12.00 ... 21.00 1.160000e+02
2 4/28/2006 7119901.48 ... 45602245.83 3.887479e+08
3 5/2/2006 346.00 ... 34534.00 4.632060e+05
4 5/12/2006 152204.22 ... 71560790.20 4.743224e+08
[5 rows x 11 columns]
从文档:
index_col : int, str, int / str 的序列,或者 False,默认None
用作 的行标签的列DataFrame,以字符串名称或列索引的形式给出。如果给出了 int / str 序列,则使用 MultiIndex。
注意:index_col=False可用于强制 pandas 不使用第一列作为索引,例如当您有一个格式错误的文件时,每行末尾都有分隔符。
从那里您可以猜测为什么默认设置index_col=None不适用于您的数据 - 您的行也用逗号分隔,:
"Date","Travels","Inward Money Transfers","Cash Sales to BDC And Banks","Letters of Credit","Total Direct Remittances","Remittances to Travelex","Remittances to Amex","WDAS","Debt Services And Payments","Total"
"10/12/2003","234234","23424","23423","2342","342","23423","3423","23423","23423","357457",
"1/12/2005","12","2","12","12","21","12","12","12","21","116",