From 959109229e397b6cdddd505e331b14e3973418cf Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 24 Jul 2024 15:00:54 +0200 Subject: [PATCH 1/2] BUG: add note on creating Series from Series with dtype keyword When creating Series from another Series `dtype` keyword is ignored. See GH #59060. Add note to the docstring to underline this behaviour to Series and DataFrame constructors. --- pandas/core/frame.py | 1 + pandas/core/series.py | 1 + 2 files changed, 2 insertions(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index ee48f546815bb..8fb091f1b3871 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -531,6 +531,7 @@ class DataFrame(NDFrame, OpsMixin): will perform column selection instead. dtype : dtype, default None Data type to force. Only a single dtype is allowed. If None, infer. + If `data` is DataFrame then is ignored. copy : bool or None, default None Copy data from inputs. For dict data, the default of None behaves like ``copy=True``. For DataFrame diff --git a/pandas/core/series.py b/pandas/core/series.py index 9209a80ada0d1..c476ad9b89ba6 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -256,6 +256,7 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] Data type for the output Series. If not specified, this will be inferred from `data`. See the :ref:`user guide ` for more usages. + If `data` is Series then is ignored. name : Hashable, default None The name to give to the Series. copy : bool, default False From bbc4d260a76adaccfdbd468f54a5490f18d11832 Mon Sep 17 00:00:00 2001 From: taranarmo Date: Wed, 24 Jul 2024 21:01:21 +0200 Subject: [PATCH 2/2] make backticks double Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/core/frame.py | 2 +- pandas/core/series.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 8fb091f1b3871..1a0d564197417 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -531,7 +531,7 @@ class DataFrame(NDFrame, OpsMixin): will perform column selection instead. dtype : dtype, default None Data type to force. Only a single dtype is allowed. If None, infer. - If `data` is DataFrame then is ignored. + If ``data`` is DataFrame then is ignored. copy : bool or None, default None Copy data from inputs. For dict data, the default of None behaves like ``copy=True``. For DataFrame diff --git a/pandas/core/series.py b/pandas/core/series.py index c476ad9b89ba6..f340821775015 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -256,7 +256,7 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] Data type for the output Series. If not specified, this will be inferred from `data`. See the :ref:`user guide ` for more usages. - If `data` is Series then is ignored. + If ``data`` is Series then is ignored. name : Hashable, default None The name to give to the Series. copy : bool, default False