3
# Código
list = [a for a in range(100,103)]
df = pd.DataFrame({
"A":['x','y','z'],
"B":[0,1,2],
"C":[0,0,0]
})
I need to replace column strings C
by the strings of list
, so that the first string of list
replace the first string of the column C
, the second string of list
replace the second string of the column C
.
I tried to apply a replace
, but in the substitution all strings of the list
inside each string in the column C
, staying that way:
0 [100, 101, 102]
1 [100, 101, 102]
2 [100, 101, 102]
The result I wish would be this:
A B C
0 x 0 100
1 y 1 101
2 z 2 102
Thank you, simple and fast
– Saulo