Вот упрощенный пример того, чего я пытаюсь достичь:
Вот упрощенный пример того, чего я пытаюсь достичь:
Вот упрощенный пример того, чего я пытаюсь достичь:
р>
Код: Выделить всё
df1 = pd.read_clipboard()
col1 col2
0 a A
1 b A
2 c B
3 d C
4 e B
df2 = pd.read_clipboard()
col2 col3
0 A Albert is the best
1 B Bernard is cool
2 C Conrad is ok
df3 # col3 being the values of df2, not copied
col1 col2 col3
0 a A Albert is the best
1 b A Albert is the best
2 c B Bernard is cool
3 d C Conrad is ok
4 e B Bernard is cool
Код: Выделить всё
df3 = pd.merge(df1, df2, on='col2', how='left')
Подробнее здесь: https://stackoverflow.com/questions/788 ... g-the-data