Reputation: 71
I have 2 dataframe namely accidents_data which has 15 columns and bad_air_quality_data dataframe whch has 5 columns.
Now i'd like to inner join both data frames on column ['District Name', 'Weekday', 'Hour', 'Month'] and finally keep only the data from accidents_data after joining.
accidents_data:
bad_air_quality_data:
I tried merging both the dataframes using the below line but it does not show any results.
accidents_data_bad_air = pd.merge(accidents_data, bad_air_quality_data, on=['District Name', 'Weekday', 'Month', 'Hour'], how='inner')
Upvotes: 0
Views: 3370
Reputation: 71
I think i figured out the solution. While merging the data the datatype of same columns were different. After making that correction, the merge worked.
Upvotes: 1