上传者: 38607479
|
上传时间: 2022-04-07 13:12:34
|
文件大小: 33KB
|
文件类型: PDF
1. 从字典创建Dataframe
>>> import pandas as pd
>>> dict1 = {'col1':[1,2,5,7],'col2':['a','b','c','d']}
>>> df = pd.DataFrame(dict1)
>>> df
col1 col2
0 1 a
1 2 b
2 5 c
3 7 d
2. 从列表创建Dataframe (先把列表转化为字典,再把字典转化为DataFrame)
>>> lista = [1,2,5,7]
>>> listb = ['a','b','c','d']
>>> df = pd.Data