#数据导入
#导入csv文件
from pandas import read_csv
ak=read_csv('D://Python projects//reference data//4.1 数据导入//1.csv')
#导入txt文件
#无表头版
from pandas import read_table
ar=read_table('D://Python projects//reference data//4.1 数据导入//2.txt')
#自定义表头版
ap=read_table('D://Python projects//reference data//4.1 数据导入//2.txt',
names=['age','name'],
sep=',')
#导入excel
from pandas import read_excel
aw=read_excel('D://Python projects//reference data//4.1 数据导入//3.xlsx',
sheetname='data')
#中文问题
from pandas import read_table
file_path='D://Python projects//reference data//4.1 数据导入//中文.txt'
am=read_table(
file_path,
sep=',',
encoding='utf-8')
#可通过engine='python'解决
fro
python的导入与导出
最新推荐文章于 2024-05-09 19:48:29 发布