I have 2 dataframes. sdf and df. In the dataframe df there are different columns with different information about measuring stations and in one column is the respective address. Also sdf has a column with addresses. I want to find out which address sdf and df are the same. However, I have the problem that the addresses are written differently. (Sometimes the street is written out, sometimes not). That's why I wanted to compare the first 5 digits of the street name. And if this matches in each case, it should create a new column with this match. Problem:
ValueError: Can only compare identically-labelled Series objects
i tried so many different things but i get always the same error or it doesnt work at all
df['Adresses_compared'] = (df['adress'].str[0:5]==sdf['adress_c'].str[0:5])
I Also tried it with mask
df['Adresses_compared']= sdf.mask(sdf['adress_c']== df1.loc[0:5, 'adress'])
In the end, I want to find a kind of intersection of the addresses that occur in both data frames.