前置工序: import pandas as pd
csv 文件读取中文错误处理: utf-8 codec can't decode ....
1
|
pd.read_csv( 'c:/mydata/jit.csv' ,encoding = 'gb18030' )
|
sql 读取:
1
2
3
4
|
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)
|
以上这篇pandas 读取各种格式文件的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/RogeDL/article/details/77822844