I'm trying to merge pandas dataframes to effectively add a column with "FIPS Codes" according to the county and state in their respective columns.
I'm using pd.merge to do this and getting NaNs. What am I doing wrong?
According to https://pandas.pydata.org/pandas-docs/stable/merging.html this should work.
merged = pd.merge(sales, fips, how='left', on=['county', 'state'])
Here is the head() of sales:
And here is the head() of fips:
And this is the merged result (with NaNs in the final fips column):
Thanks!