Skip to content
Advertisement

FutureWarning: The default value of regex will change from True to False in a future version

I’m running below code to clean text

JavaScript

Then it returns a warning

JavaScript

Could you please elaborate on the reason of this warning?

Advertisement

Answer

See Pandas 1.2.0 release notes:

The default value of regex for Series.str.replace() will change from True to False in a future release. In addition, single character regular expressions will not be treated as literal strings when regex=True is set (GH24804)

I.e., use regular expressions explicitly now:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement