texthero.preprocessing.remove_digits¶
-
remove_digits
(input: pandas.core.series.Series, only_blocks=True) → pandas.core.series.Series¶ Remove all digits and replace it with a single space.
By default, only removes “blocks” of digits. For instance, 1234 falcon9 becomes ` falcon9`.
When the arguments only_blocks is set to ´False´, remove any digits.
See also
replace_digits()
to replace digits with another string.- Parameters
- inputPandas Series
- only_blocksbool
Remove only blocks of digits.
Examples
>>> import texthero as hero >>> import pandas as pd >>> s = pd.Series("7ex7hero is fun 1111") >>> hero.preprocessing.remove_digits(s) 0 7ex7hero is fun dtype: object >>> hero.preprocessing.remove_digits(s, only_blocks=False) 0 ex hero is fun dtype: object