From 500e7c00122d115954e512505fffb4969264443a Mon Sep 17 00:00:00 2001 From: tpaxman Date: Sat, 24 Jun 2023 21:48:42 -0600 Subject: [PATCH 1/4] add code formatting and reference links to read_clipboard docstring --- pandas/io/clipboards.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index c25e184680f44..122457145ec0a 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -26,31 +26,31 @@ def read_clipboard( **kwargs, ): # pragma: no cover r""" - Read text from clipboard and pass to read_csv. + Read text from clipboard and pass to :func:`pandas.read_csv`. Parameters ---------- sep : str, default '\\s+' - A string or regex delimiter. The default of '\\s+' denotes + A string or regex delimiter. The default of ``'\\s+'`` denotes one or more whitespace characters. dtype_backend : {"numpy_nullable", "pyarrow"}, defaults to NumPy backed DataFrames Which dtype_backend to use, e.g. whether a DataFrame should have NumPy arrays, nullable dtypes are used for all dtypes that have a nullable - implementation when "numpy_nullable" is set, pyarrow is used for all - dtypes if "pyarrow" is set. + implementation when ``'numpy_nullable'`` is set, pyarrow is used for all + dtypes if ``'pyarrow'`` is set. The dtype_backends are still experimential. .. versionadded:: 2.0 **kwargs - See read_csv for the full argument list. + See :func:`pandas.read_csv` for the full argument list. Returns ------- DataFrame - A parsed DataFrame object. + A parsed :class:`pandas.DataFrame` object. """ encoding = kwargs.pop("encoding", "utf-8") From f580db6baddb0a70500ab186afd2e926bb253e1c Mon Sep 17 00:00:00 2001 From: tpaxman Date: Sat, 24 Jun 2023 22:04:43 -0600 Subject: [PATCH 2/4] add extended summary, see-also, and examples sections to ensure docstring is fully validated --- pandas/io/clipboards.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index 122457145ec0a..bea4a5e917541 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -28,6 +28,9 @@ def read_clipboard( r""" Read text from clipboard and pass to :func:`pandas.read_csv`. + Parses clipboard contents similar to how CSV files are parsed + using :func:`pandas.read_csv`. + Parameters ---------- sep : str, default '\\s+' @@ -51,6 +54,16 @@ def read_clipboard( ------- DataFrame A parsed :class:`pandas.DataFrame` object. + + See Also + -------- + DataFrame.to_clipboard : Copy object to the system clipboard. + read_csv : Read a comma-separated values (csv) file into DataFrame. + read_fwf : Read a table of fixed-width formatted lines into DataFrame. + + Examples + -------- + >>> pd.read_clipboard() # doctest: +SKIP """ encoding = kwargs.pop("encoding", "utf-8") From 9dd6b4f5724ef3203c0633a566aebc7aac49c04a Mon Sep 17 00:00:00 2001 From: tpaxman Date: Sat, 24 Jun 2023 22:06:45 -0600 Subject: [PATCH 3/4] hide "pandas" from each :func: and :class: reference --- pandas/io/clipboards.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index bea4a5e917541..4acc719713c0e 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -26,10 +26,10 @@ def read_clipboard( **kwargs, ): # pragma: no cover r""" - Read text from clipboard and pass to :func:`pandas.read_csv`. + Read text from clipboard and pass to :func:`~pandas.read_csv`. Parses clipboard contents similar to how CSV files are parsed - using :func:`pandas.read_csv`. + using :func:`~pandas.read_csv`. Parameters ---------- @@ -48,12 +48,12 @@ def read_clipboard( .. versionadded:: 2.0 **kwargs - See :func:`pandas.read_csv` for the full argument list. + See :func:`~pandas.read_csv` for the full argument list. Returns ------- DataFrame - A parsed :class:`pandas.DataFrame` object. + A parsed :class:`~pandas.DataFrame` object. See Also -------- From cb8e3b860d2ddf8e8de6524bd27ec1d760e4fd05 Mon Sep 17 00:00:00 2001 From: tpaxman Date: Sat, 24 Jun 2023 22:07:45 -0600 Subject: [PATCH 4/4] fix typos --- pandas/io/clipboards.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index 4acc719713c0e..72ece9cd68be4 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -38,12 +38,12 @@ def read_clipboard( one or more whitespace characters. dtype_backend : {"numpy_nullable", "pyarrow"}, defaults to NumPy backed DataFrames - Which dtype_backend to use, e.g. whether a DataFrame should have NumPy + Which dtype_backend to use, e.g., whether a DataFrame should have NumPy arrays, nullable dtypes are used for all dtypes that have a nullable implementation when ``'numpy_nullable'`` is set, pyarrow is used for all dtypes if ``'pyarrow'`` is set. - The dtype_backends are still experimential. + The dtype_backends are still experimental. .. versionadded:: 2.0