![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python学习
Python学习过程中的一些问题记录
li_huizhen
这个作者很懒,什么都没留下…
展开
-
pandas读取excel文件并获取Excel文件下所有的sheet名称
pandas读取excel文件并获取Excel文件下所有的sheet名称通过DataFrame.keys获取excel文件的sheet_name如下代码所示,导入pandas模块,并读取excel文件,打印前5行查看数据:import pandas as pddf = pd.read_excel('test.xlsx')#获取文件前五行数据df.head()想要使用DataFrame.keys()打印当前excel文件的所有sheet_name,结果运行代码之后却获取到了excel文件第一原创 2021-12-13 14:18:22 · 19204 阅读 · 1 评论 -
在jupyter notebook中读取CSV文件报错
import pandas as pddf = pd.read_csv('Pokemon1.csv',index_col = 0)执行代码之后报错:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x89 in position 1538: invalid start byte尝试手动指定编码格式【encoding=“utf-8”/encoding=“gbk”】依然报错:df = pd.read_csv('Pokemon1.csv',inde原创 2021-12-10 14:13:58 · 6163 阅读 · 1 评论