pandas读取excel带汉字的列头,Pandas读取excel与中文文件名

I am trying to load as a pandas dataframe a file that has Chinese characters in its name.

I've tried:

df=pd.read_excel("url/某物2008.xls")

and

import sys

df=pd.read_excel("url/某物2008.xls", encoding=sys.getfilesystemencoding())

But the response is something like: "no such file or directory "url/\xa1\xa92008.xls"

I've also tried changing the names of the files using os.rename, but the filenames aren't even read properly (asking python to just print the filenames yields only question marks or squares).

解决方案df=pd.read_excel(u"url/某物2008.xls", encoding=sys.getfilesystemencoding())

may work... but you may have to declare an encoding type at the top of the file

你可能感兴趣的:(pandas读取excel带汉字的列头,Pandas读取excel与中文文件名)