There are two DataFrames that I want to merge:
DataFrame A columns: index, userid, locale (2000 rows)
DataFrame B columns: index, userid, age (300 rows)
When I perform the following:
pd.merge(A, B, on='userid', how='outer')
I got a DataFrame with the following columns:
index, Unnamed:0, userid, locale, age
The index
column and the Unnamed:0
column are identical. I guess the Unnamed:0
column is the index column of DataFrame B.
My question is: is there a way to avoid this Unnamed
column when merging two DFs?
I can drop the Unnamed
column afterwards, but just wondering if there is a better way to do it.