python读取excel
需要安装XLRD模块
pandas.read_excel() pandas.read_csv()
sheet_name 指定sheet
index_col 指定行索引
header 指定列索引
usecols 指定导入列
sep 指定CSV分隔符内容(常见的有逗号,空格,制表符(\t))
nrows 指明读取行数
encoding 指明编码格式 默认 UTF-8 更改为 gbk
engine(消除路径或者文件名中有中文导入时的错误)指定编程语言
sql文件导入
先连接
import pymysql
pymysql.connect()
连接信息:user,password,host(数据库地址/本机使用localhost)
db(数据库名称)
charset(数据库编码,一般UTF-8)
文件
pandas.read_sql(查询参数,数据库connect参数)
shape 数据表大小
info 数据类型
describe 数值类型的字段分布
浙公网安备 33010602011771号