0

So here's my daily challenge :

I have an Excel file containing a list of streets, and some of those streets will be doubled (or tripled) based on their road type. For instance :

Example of duplicates

In another Excel file, I have the street names (without duplicates) and their mean distances between features such as this :

enter image description here

Both Excel files have been converted to pandas dataframes as so :

duplicates_df = pd.DataFrame()
duplicates_df['Street_names'] = street_names


dist_df=pd.DataFrame()
dist_df['Street_names'] = names_dist_values
dist_df['Mean_Dist'] = dist_values
dist_df['STD'] = std_values

I would like to find a way to append the values of mean distance and STD many times in the duplicates_df whenever a street has more than one occurence, but I am struggling with the proper syntax. This is probably an easy fix, but I've never done this before.

The desired output would be :

enter image description here

Any help would be greatly appreciated!

Thanks again!

Maxime Campeau
  • 109
  • 1
  • 8

1 Answers1

0
pd.merge(duplicates_df, dist_df, on="Street_names")
mujjiga
  • 16,186
  • 2
  • 33
  • 51