I am trying to replace a string in one column with another string using .where like this:
dfn = df.where(df['name'].str.count(' ') < 2, df['name'].replace(' ', ' _ '), axis=1)
The right columns are found but the whole row is replaced with NaN...
Thank You
Aucun commentaire:
Enregistrer un commentaire