2015-09-28 141 views

回答

6

您正在尋找的功能concat

import pandas as pd 

df1 = pd.DataFrame({'col1':['a','b'],'col2':[33,44]}) 

df2 = pd.DataFrame({'col3':['dog'],'col2':[32], 'col4':[1]}) 

In [8]: pd.concat([df1, df2]) 
Out[8]: 
    col1 col2 col3 col4 
0 a 33 NaN NaN 
1 b 44 NaN NaN 
0 NaN 32 dog  1