0

I have a dataframe with multiple columns. I know to change the value based on condition for one specific column. But how can I change the value based on condition over all columns for the whole dataframe? I want to replace // with 1

col1;col2;col3;col4;
23;54;12;//;
54;//;2;//;
8;2;//;1;
Gobrel
  • 179
  • 9

1 Answers1

1

Let's try

df = df.replace('//', 1)
# or
df = df.mask(df.eq('//'), 1)
Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52