2
R的plyr函数有: rbind.fill()这是一种附加不等数据列数据帧的方法。R rbind.fill等效于Python Pandas
python/pandas DataFrame有没有类似的函数?
R的plyr函数有: rbind.fill()这是一种附加不等数据列数据帧的方法。R rbind.fill等效于Python Pandas
python/pandas DataFrame有没有类似的函数?
您正在寻找的功能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
是它。谢谢! – Nikhil