Mapping Error: A value is trying to be set on a copy of a slice from a DataFrame

I get the error: “A value is trying to be set on a copy of a slice from a DataFrame” when I try to map. I’m not sure how to fix this. I’ve tried .loc but that doesn’t work either.

df1[‘Total’] = df1[‘Year’].map(df2.set_index(‘Year’)[‘Total’])