创建数据

numpy方法

-   np.arange        
-   np.random  
-   np.random.randn   
-   np.random.randint   
-   np.random.random
import numpy as np 
import pandas as pd
[[利用numpy]]创建
index1 = list('abcd')
col1= ['one','two','three','four']
df = pd.DataFrame(np.arange(16).reshape(4,4),index = index1,columns = col1)
print(df)

to_range方法

字典 推导式

-   pd.DadaFrame(np.random.rand(20,5)):创建20行5列的随机数组成的DataFrame对象
-   pd.Series(my_list):从可迭代对象my_list创建一个Series对象