In [3]: import pandas as pd In [4]: a = pd.Series([1,2,3]) In [5]: b = pd.Series([2,3,4]) In [6]: c = pd.DataFrame([a,b]) In [7]: cOut[7]: 0 1 20 1 2 31 2 3 4
不过pandas直接用列表生成dataframe只能按行生成,如果是字典可以按列生成,比如:
In [8]: c = pd.DataFrame({'a':a,'b':b}) In [9]: cOut[9]: a b0 1 21 2 32 3 4