Python之pandas读写文件乱码的解决方法
作者:渐行渐远silence 时间:2021-03-18 20:25:35
python读写文件有时候会出现
‘XXX'编码不能打开XXX什么的,用记事本打开要读取的文件,另存为UTF-8编码,然后再用py去读应该可以了。如果还不行,那么尝试使用文件原有的编码方式读取,参考之前的文章
在pandas中读写csv时候通过制定encoding可以有效防止excel打开或者写入中文乱码
data.to_csv(f_out,index=False,encoding='gb2312')
来源:https://blog.csdn.net/silence2015/article/details/65642234
标签:pandas,文件,读写,乱码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python爬虫突破反爬虫机制知识点总结
2021-09-17 12:38:22
基于Python实现自动化生成数据报表
2021-11-07 00:42:16
![](https://img.aspxhome.com/file/2023/7/68877_0s.jpg)
Python无损音乐搜索引擎实现代码
2021-01-28 19:19:02
![](https://img.aspxhome.com/file/2023/5/67325_0s.jpg)
用Python画一个LinkinPark的logo代码实例
2022-09-27 05:52:19
![](https://img.aspxhome.com/file/2023/9/90339_0s.png)
python中bottle使用实例代码
2023-07-03 14:21:15
![](https://img.aspxhome.com/file/2023/9/105809_0s.png)
Python的log日志功能及设置方法
2022-03-28 22:13:32
账户名和密码漏输或误输的文字提示
2009-06-24 14:28:00
![](https://img.aspxhome.com/file/UploadPic/20096/24/12-25s.png)
python基于Opencv实现人脸口罩检测
2021-11-18 02:45:16
![](https://img.aspxhome.com/file/2023/2/87472_0s.jpg)
自然描述与自然任务
2010-01-26 15:51:00
![](https://img.aspxhome.com/file/UploadPic/20101/26/pic0-99s.jpg)
ipython jupyter notebook中显示图像和数学公式实例
2022-06-20 12:19:37
让我们走进ASP.NET世界
2007-08-24 08:52:00
Python使用百度API上传文件到百度网盘代码分享
2023-08-05 02:38:52
Python跨文件全局变量的使用技巧
2023-09-17 00:00:31
ASP.NET教程第一讲 ASP.NET简介
2007-08-07 11:50:00
Python实现的对一个数进行因式分解操作示例
2023-01-11 04:30:40
ASP实例:即时显示当前页面浏览人数
2008-04-19 22:02:00
细化解析:MySQL 数据库中对XA事务的限制
2009-01-14 11:59:00
Python写代码的七条重要技巧介绍
2023-09-14 06:04:07
![](https://img.aspxhome.com/file/2023/7/88847_0s.jpg)
js实现圆形菜单选择器
2023-09-23 19:50:54
![](https://img.aspxhome.com/file/2023/8/56308_0s.jpg)
python实现基于信息增益的决策树归纳
2022-05-20 14:22:47