创建对象
1.传入list创建Series,并生成默认的整形索引
import pandas as pd
s = pd.Series([1, 2, 3, 4, 5])
print(s)
2.指定索引创建Series
import pandas as pd
s = pd.Series([1, 2, 3, 4, 5], index=['a', 'b', 'c', 'd', 'e'])
print(s)
3.创建DataFrame对象
import pandas as pd
dates = pd.date_range('20170101', periods=5)
df = pd.DataFrame(np.random.randn(5,4), index=dates, columns=list('ABCD'))
# randn表示生成一个维度为五行四列的数组并且服从正态分布
print(df)
#传入python的dict创建DataFrame数组
df2 = pd.DataFrame({"a":1, "b":2, "c":3, "d":4, "e":("e1", "e2", "e3")})
print(df2)
4.数据查看
import pandas as pd
import numpy as np
df