Pandas

2016-09-15
df1 = pd.DataFrame({'A': [0, 1, 2]}, index=['foo', 'bar', 'baz'])

df1.index.name = 'MyIndex'

df2 = pd.DataFrame({'B': ['foo', 'bar', 'baz'], 'C': ['yolo', 'lol', 'bam']})

merged = df1.merge(df2, left_index=True, right_on='B')

muh muh muh

Continue reading