鍍金池/ 問答/數(shù)據(jù)分析&挖掘  Python  網(wǎng)絡(luò)安全  Office/ 使用pandas讀取excel終端直接亂碼該怎么解決?

使用pandas讀取excel終端直接亂碼該怎么解決?

用 pandas(0.19.2) 讀取 excel 文件內(nèi)容,本地的 xlrd 也是最新版本代碼如下:

dataframe = pd.read_excel(file_url, header=1,skiprows=1)

結(jié)果終端亂碼,kill 掉也無濟(jì)于事,想知道這是什么問題導(dǎo)致的。。。

clipboard.png

按照網(wǎng)上的示例,加上了終端的中文支持設(shè)置,但是似乎并沒有效果,感覺問題不是在這里

回答
編輯回答
久愛她

讀取excel時(shí)候,增加encoding屬性,改改看,

dataframe = pd.read_excel(file_url, header=1,skiprows=1,encoding='utf-8')
或者
dataframe = pd.read_excel(file_url, header=1,skiprows=1,encoding='iso-8859-1')
2017年5月29日 22:56