Python3使用Pandas读取.csv文件报错:Initializing from file failed
问题原因:
一般是因为你的文件名中带有中文:
import pandas as pd
#读取csv
students1 = pd.read_csv('./01-练习/11-Pandas/32.csv',index_col='ID')
print(students1)
解决方法:
import pandas as pd
#读取csv
s1 = open('./01-练习/11-Pandas/32.csv')
students1 = pd.read_csv(s1,index_col='ID')
print(students1)
网友评论