列表,序列(pandas.Series), numpy.ndarray的字典
二維numpy.ndarray
別的DataFrame
結構化的記錄(structured arrays)
其中,我最喜歡的是通過二維ndarray創建DataFrame,因為代碼敲得最少:
8
import
pandas as pd
import
numpy as np
df = pd.DataFrame(np.random.randn(3,
4))
df
0
1 2 3
0
0.236175 -0.394792 -0.171866
0.304012
1
0.651926 0.989046
0.160389 0.482936
2
-1.039824 0.401105 -0.492714
-1.220438