1.为什么会出现乱码问题,用什么方式编码就用什么方式解码,由于csv不是用的utf-8编码,故不能用它解码. 常用的编码方式有 utf-8,ISO-8859-1.GB18030等. 2.中文乱码原因: 一般的csv文件如果使用 data = pd.read_csv("data__361_46.csv", encoding='utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 0: in
续上一篇博客(‘’selenium爬取NBA并将数据存储到MongoDB‘)https://www.cnblogs.com/lutt/p/10810581.html 本篇的内容是将存储到mongo的数据用pandas读取出来,存到CSV文件,然后pandas读取CSV文件. 其中mongo的操作涉及到授权的问题: 如果遇到报错关于authenticate的,需要加授权,用时需要将各参数换成自己的 #导入相应的包 import pymongo import pandas as pd from pa
不管对于read_csv还是read_excel,现在都有: usecols : int or list, default None If None then parse all columns, If int then indicates last column to be parsed If list of ints then indicates list of column numbers to be parsed If string then indicates comma separa