I am new to pandas, I am facing issue with replacing. So I am creating a function which replaces the values of column of a data frame based on the parameters. The condition is that it should replace all values of the column with only one value, as show below: Though I tried getting an error 'lenght didn't match'
def replace(df,column,condition):
for i in column:
for j in condition:
df[i]=j
return df
column = ['A','C']
condition = 11,34
df
A B C
0 12 5 1
1 13 6 5
2 14 7 7
replace(df,column,condition)
my excepted output:
A B C
0 11 5 34
1 11 6 34
2 11 7 34