0

I have an error trying to replace the value

table.loc[table['Column1'].str.contains('Unnamed'), 'Column1'] = np.NaN

A value is trying to be set on a copy of a slice from a DataFrame

Any suggestion?

2 Answers2

0

You could use the apply method

def changer(x):
    if 'unnamed' in x:
         x= np.NaN
    return x

df['column'].apply(changer)
Ade_1
  • 1,480
  • 1
  • 6
  • 17
0

Solved: table=table.copy() include before the code