May-05-2017, 09:37 PM
I hope you are all having a good day. I want to know why my merge below is returning the key error that is stated below my code. Any help would be appreciated.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
dict1={'eggs':(1,7,44,76,23,56,22,21,20,11,12,81),'month':('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec')}
dict2={'bread':(22,43,17,9,22,16,71,82,24,34,54,45),'months':('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec')}
df1=pd.DataFrame(dict1)
df2=pd.DataFrame(dict2)
df1.columns.values[1]='months'
pd.merge(left=df1,right=df2,on='months')KeyError: 'months'
