I am trying to create a python code aiming to match 2 tables puit_1
and puit_2
in order to retrieve the identifier id of the table puit_2
by creating a new column id in the table puit_1
, if the name of the table puit_1
equals the table puit_2
.
below the loop :
puits_sig[id_credo] = pd.series([])
for j in range(len(puits_credo['noms'])):
id_pcredo = []
for i in range(len(puits_sig['sigle_puits'])):
if puits_credo['noms'][j] == puits_credo['noms'][j]:
if str(puits_sig['sigle_puits'][i]) in puits_credo['noms'][j]:
id_pcredo.append(puits_credo['ID_Objet'][j])
print(id_pcredo)
puits_sig['id_credo'] = id_pcredo
ValueError : length of values 1 does not match length of index 1212
This code gives me an error that I couldn't solve (for information, I'm a beginner in programming).
Any help below some extract from tables? Extract from table 1
[sigle_puit] | [categorie] |
---|---|
BNY2D | ACTIF |
BRM2 | INACTIF |
Extract from table 2
[Nom] | [ID Object] |
---|---|
BLY23 | 89231 |
BRM1 | 12175 |