Appending is adding two dataframe 'on top of each other' so you add rows. If you want to add new columns to your dataframe from another dataframe, you use join
or merge
especially if you have a key column
where you can merge, which is in your case Postal Code
In pandas we use pd.merge
for merging two dataframes with each other like the followng:
df_final = pd.merge(df, dff, on='Postal Code')
Postal Code Borough Neighbourhood Lattitude Longitude
0 M1B Scarborough Rouge 43.806686 -79.194353
1 M1B Scarborough Malvern 43.806686 -79.194353
2 M1C Scarborough Port Union 43.784535 -79.160497
3 M1C Scarborough Rouge Hill 43.784535 -79.160497
4 M1C Scarborough Highland Creek 43.784535 -79.160497
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.