0
I have a dataframe in Pandas and need to replace the value in the column semana
conditionally. Where the value is 53
, I want to replace with 1
.
cod; semana;
A; 53;
A; 1;
A; 1;
A; 2;
B; 53;
B; 1;
B; 1;
B; 2;
That’s what I tried, but to no avail:
df = pd.read_csv("file.csv", encoding = "utf-8", delimiter = ";")
for dado in df['semana']:
if dado == 53:
df['semana'].replace(dado, 1)
Thank you very much Paulo!
– standardmarcelo