我有两个数据帧,如下所示
测向
Type Breed Common Color Other Color Behaviour
Golden Big Gold White Fun
Corgi Small Brown White Crazy
Bulldog Medium Black Grey Strong
df2型
Type Breed Behaviour Bark Sound
Pug Small Sleepy Ak
German Shepard Big Cool Woof
Puddle Small Aggressive Ek
我想按列Type
、Breed
和Behavior
合并2个数据帧。你知道吗
因此,我的愿望是:
Type Breed Behavior
Golden Big Fun
Corgi Small Crazy
Bulldog Medium Strong
Pug Small Sleepy
German Shepard Big Cool
Puddle Small Aggressive
使用
join
删除不重叠的列您需要^{} :
更通用的方法是对两个} :
DataFrames
的列使用^{如果} 删除带有
df1
和df2
没有NaN
值,则使用^{NaN
的列:相关问题 更多 >
编程相关推荐