-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
Description
Pandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
mainhere
Location of the documentation
pandas.read_csv and https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
Documentation problem
The deprecation warning for the delim_whitespace option suggests using sep="\s+" instead. Since \s is not a valid escape sequence, in Python 3.11 and earlier this is equivalent to sep=r"\s+".
However, in Python 3.12, invalid escape sequences now generate SyntaxWarnings. I would suggest that Pandas should avoid advising users to add code that will generate warnings (in particular when doing so via a warning—if the suggestion is implemented, then the number of warnings would remain constant rather than decreasing)
Suggested fix for documentation
Replace all instances of sep="\s+" with either sep=r"\s+" or sep="\\s+".