You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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+".
The text was updated successfully, but these errors were encountered:
Similar to what I said in #58488, not sure if this is worth fixing considering there's already a PR working on removing this parameter in #58280
We could fix this and backport it to the current docs, but I'm not sure if that's really necessary
Ah, I hadn't realised that removing the parameter entirely was so imminent. I agree that it's probably not worth backporting documentation changes for this.
Pandas version checks
main
hereLocation of the documentation
pandas.read_csv
and https://pandas.pydata.org/docs/reference/api/pandas.read_csv.htmlDocumentation problem
The deprecation warning for the
delim_whitespace
option suggests usingsep="\s+"
instead. Since\s
is not a valid escape sequence, in Python 3.11 and earlier this is equivalent tosep=r"\s+"
.However, in Python 3.12, invalid escape sequences now generate
SyntaxWarning
s. 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 eithersep=r"\s+"
orsep="\\s+"
.The text was updated successfully, but these errors were encountered: