Joining in Pandas

Hi,

While joining between 2 dataframe, will pandas automatically detect which
columns are primary key and foreign key, like state in this case

combined = population_2012.join(electoral_votes)
combined.head()
``

It is joining on index, which is the same for both in this case. ie. state. Default is index. You can specify if particular key is needed.

1 Like

Hi Anshuman,

Thanks for the clarification,
what will happen if we don’t have index on dataframe like state defined here.

Thanks and Regards,
Subho

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.join.html

This might help…

2 Likes

ok thanks will check this link