python之外部数据的读取

外部数据的读取

文本文件的读取

Example
# 文本文件的读取
import pandas as pd
text = pd.read_csv('data_test01.txt', sep=',', names=['序号', '出生年', '月份', '日期', '性别', '职位', '薪资'], skiprows=2,skipfooter=3,engine='python')
print(text)

电子表格的读取

Example
excel = pd.read_excel('data_test02.xlsx', header=None, names=['编号', '服饰名称', '颜色', '价格'])
print(excel)

数据库数据的读取

# 数据量
df.shape
# 列名称
df.columns
# 变量类型
df.dtypes
# 统计描述
df.describe(include='')
# 显示部分数据
df.head()
posted @ 2020-11-05 11:23  godlover  阅读(380)  评论(0编辑  收藏  举报