Pandas version checks

  • [X] I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.read_clipboard.html

Documentation problem

Backslash is missing in the Parameters section:

pandas.read_clipboard(sep='\\s+', **kwargs) ... Parameters sep : str, default ‘s+’ A string or regex delimiter. The default of ‘s+’ denotes one or more whitespace characters.


Relevant source code:

def read_clipboard(sep: str = r"\s+", **kwargs):  # pragma: no cover
    r"""
    ...

    Parameters
    ----------
    sep : str, default '\s+'
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    ...
    """

Suggested fix for documentation

I believe your documentation generator is removing the backslash at some point, so hopefully there's a way to turn that off.

I don't believe this issue has much impact. At worst it could confuse some newcomers, that's about it.

Comment From: topper-123

Hmm, if we escape the backslash, the raw doc string is wrong (people use that too, e.g. in editors). So this may not be fixable, though the problem is clear enough.

Suggestions welcome on how to fix this of course, but we may have to close it as a cantfix...

Comment From: wjandrea

@topper-123 Now that I think about it, the default is actually '\\s+' (from r'\s+') and '\s' is deprecated syntax. So escaping it would be fine, no? The docs would end up with '\s+', which is not ideal, but at least better.

To be extra clear: - the signature is: r'\s+' -> '\\s+' - the docstring says: r"""... '\s+' ...""" -> "... '\\s+' ..." -> but then printed as: ... '\s+' ..., which shows the deprecated syntax - if you escaped the docstring: r"""... '\\s+' ...""" -> "... '\\\\s+' ..." -> printed as: ... '\\s+' ...

Comment From: topper-123

yes, I think you are right. PR on this welcome.