equivalent of gsub for Pandas Series / DataFrame

pandas, python-3.x, r

Solution

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 =)

Problem

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

Original source

Related problems