pandas 读取各种格式文件的方法

pandas 读取各种格式文件:

前置工序: import pandas as pd

csv 文件读取中文错误处理: utf-8 codec can't decode ....

pd.read_csv('c:/mydata/jit.csv',encoding='gb18030')

sql 读取:

import pymysql
conn=pymysql.connect(host='127.0.0.1', user='root', passwd='root', db=' employee')
sql='select * from employee'
pd.read_sql(sql, conn)

相关推荐