2
I have two df1 and df2 dataframes, both have team column, but only df2 have the numeral column that every day changes, wanted the values of the numeral column to turn a column in df1, but always in front of the responsible team
example:
df1:
equipe
a
b
b
a
c
a
b
df2:
equipe numeral
a 1
b 2
c 3
wanted df1 to stay:
df1:
equipe numeral
a 1
b 2
b 2
a 1
c 3
a 1
b 2
I used this code, but it generates an entire empty column
def comunidade(num):
if num == 'a':
return def2.loc[index, 'def2']
elif num == 'b':
return def2.loc[index, 'def2']
elif num == 'c':
return def2.loc[index, 'def2']
df1['numeral'] = df2['numeral'].map(comunidade)
It worked perfectly, thank you
– Simone