-1
Good night!
I have two dataframes ex8_alunos
and ex8_cursos
I would like to create a column on ex8_alunos
calling for CO_UF
To power this column I would need to cross-reference the data from the two dataframes mentioned above
In the ex8_cursos
use the CO_IES
and the CO_UF
to create in the ex8_alunos
the column CO_UF
and with the respective UF Codes of each faculty.
I tried the following method without result:
ex8_alunos['CO_UF'] = 0
for i in range (0, ex8_alunos.shape[0]):
if ex8_alunos.at[i, "CO_IES"] == ex8_cursos["CO_IES"]:
ex8_alunos['CO_UF'] = ex8_alunos['CO_UF'].append(ex8_cursos["CO_IES"].loc[[i]])
Can someone help me? Thanks in advance!
can make the data available or make an MWE?
– Lucas
I’m providing!
– Luis Henrique Batista
This answers your question? Take values from a column of a dataframe and create a column in another with the corresponding values
– Lucas
ex8_alunos ex8_courses
– Luis Henrique Batista
ex8_alunos['CO_UF'] = 0
ex8_alunos['CO_UF'] = ex8_alunos.merge(ex8_cursos, on='CO_UF', how='left')
It didn’t work out– Luis Henrique Batista