From 01d9bd2d4ddb4e73f0a0aa6c2a6a2f0af7753a31 Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Wed, 3 Jun 2020 18:58:22 +0000 Subject: [PATCH 1/6] Change in DataFrame.reindex doc summary and result --- pandas/core/generic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 8aa8f8bb60654..a5921ae3f5dc1 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4241,9 +4241,9 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: """ Conform %(klass)s to new index with optional filling logic. - Places NA/NaN in locations having no value in the previous index. A new object - is produced unless the new index is equivalent to the current one and - ``copy=False``. + Places NA/NaN in locations having no value in the previous index. A new + DataFrame with an additional index is generated subject to customization + with parameters. Parameters ---------- @@ -4286,7 +4286,7 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: Returns ------- - %(klass)s with changed index. + %(klass)s with 2 indices. See Also -------- From d1daba4cd6011af7bf1d7d791ad6ec766e88853d Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Sat, 6 Jun 2020 19:10:08 +0000 Subject: [PATCH 2/6] DataFrame reindex summary/return: 2nd attempt --- pandas/core/generic.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index a5921ae3f5dc1..9c5b09d87d918 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4239,11 +4239,12 @@ def sort_values( def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: """ - Conform %(klass)s to new index with optional filling logic. + Generates an object with a new index and columns retained from %(klass)s. + The values are only retained for those index that matches those in + %(klass)s else NA/Nan. - Places NA/NaN in locations having no value in the previous index. A new - DataFrame with an additional index is generated subject to customization - with parameters. + If the new index is entirely equivalent to the current one and copy=false + then the %(klass)s remains intact. Parameters ---------- @@ -4286,7 +4287,7 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: Returns ------- - %(klass)s with 2 indices. + %(klass)s with a new index. See Also -------- From b15b121163db71cbeaaabefa84557efe8eb6d54f Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Sat, 6 Jun 2020 20:04:56 +0000 Subject: [PATCH 3/6] DataFrame reindex Summary/return: 3 --- pandas/core/generic.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 9c5b09d87d918..921458b865a05 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4239,12 +4239,9 @@ def sort_values( def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: """ - Generates an object with a new index and columns retained from %(klass)s. - The values are only retained for those index that matches those in - %(klass)s else NA/Nan. + Create an object with a new index and columns retained from %(klass)s. - If the new index is entirely equivalent to the current one and copy=false - then the %(klass)s remains intact. + The values are only retained for those index that matches those in %(klass)s else NA/Nan. If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. Parameters ---------- From 68cad277f03cdb614b462d1925b3797cc5d13362 Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Sat, 6 Jun 2020 20:31:49 +0000 Subject: [PATCH 4/6] DataFrame reindex Summary/return: 4 --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 921458b865a05..36d577cc5abe0 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4241,7 +4241,7 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: """ Create an object with a new index and columns retained from %(klass)s. - The values are only retained for those index that matches those in %(klass)s else NA/Nan. If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. + The values are only retained for index that matches in %(klass)s else NA/Nan. If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. Parameters ---------- From ba7a18a081b724ef96b3a58f51ce6c708179d607 Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Sat, 6 Jun 2020 21:12:43 +0000 Subject: [PATCH 5/6] DataFrame reindex Summary/return: 5 --- pandas/core/generic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 36d577cc5abe0..b36741a98cbb0 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4241,7 +4241,8 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: """ Create an object with a new index and columns retained from %(klass)s. - The values are only retained for index that matches in %(klass)s else NA/Nan. If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. + The values are only retained for index that matches in %(klass)s else NA/Nan. + If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. Parameters ---------- From de99347095c16ea96634e668db2a382ccb7fac2c Mon Sep 17 00:00:00 2001 From: gauravchandok Date: Sat, 6 Jun 2020 21:18:31 +0000 Subject: [PATCH 6/6] DataFrame reindex Summary/return: 6 --- pandas/core/generic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index b36741a98cbb0..2bbd261faeddf 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4242,7 +4242,8 @@ def reindex(self: FrameOrSeries, *args, **kwargs) -> FrameOrSeries: Create an object with a new index and columns retained from %(klass)s. The values are only retained for index that matches in %(klass)s else NA/Nan. - If the new index is entirely equivalent to the current one and copy=false then the %(klass)s remains intact. + If the new index is entirely equivalent to the current one and copy=false the + %(klass)s remains intact. Parameters ----------