Good afternoon Mauricio, all right?
I believe that if the pandas is identifying the '/' character, you can use the 'apply' function'.
novodf = antigodf.apply(lambda x: x.replace('/','0'))
This way you would replace '/' with '0'
If you want to replace the/' value with Nan, to use functions related to null numbers of the pandas, import the numpy library and replace the apply '0' with np.Nan, thus:
import numpy as np
novodf = antigodf.apply(lambda x: x.replace('/',np.nan))
If you want to replace Nan, you can use the function fillna()
passing the value that will replace Nan
novodf.fillna(0)
This command would replace Nan values with 0.
Here is a link from Paulo Vasconcellos' website with great tips for pandas and data : Paulovasconcellos
I hope I’ve helped.
Thank you.
Claudio.
Thanks Claudio!
– Mauricio Soares
I was unsuccessful using the expression novodf = antigodf.apply(lambda x: x.replace('/','0')). No execution error occurs, but it does not replace the character "/".
– Mauricio Soares