What is the equivalent of R's sub
/ gsub
functions for Python pandas
' Series
or DataFrame
?
For example, in R, my code is
schData<-gsub("/"," by ",schData,ignore.case=F)
What would be equivalent operation in Python when schData
above is as follows:
>>> type(schData)
Out[N]: pandas.core.series.Series
for regular strings there is the re.sub
function but that only seems to work with strings
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.replace.html
That the type of thing you're looking for?
Python pandas equivalent for replace Has a few little examples.
PS: please include a reproducible example next time =)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With