From 4a04243518577aa8adda7d3c1bec50e210b3ab10 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Fri, 31 Jul 2020 11:55:39 +0200 Subject: [PATCH 01/10] [IMP] - #35491 - added note docstring --- pandas/core/frame.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 3f634c1e6e1ff..cae6fffe049ea 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5897,6 +5897,9 @@ def _construct_result(self, result) -> "DataFrame": ----- Matching NaNs will not appear as a difference. +Can only compare identically-labeled DataFrame objects, +this means DataFrames with identical row and column label. + Examples -------- >>> df = pd.DataFrame( From b809ca79fdf67d0c104fe0b5b59a65c291baa905 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Fri, 31 Jul 2020 11:58:55 +0200 Subject: [PATCH 02/10] [FIX] - #35491 - remove trailing whitespace --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index cae6fffe049ea..3d34729a54bdf 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5897,7 +5897,7 @@ def _construct_result(self, result) -> "DataFrame": ----- Matching NaNs will not appear as a difference. -Can only compare identically-labeled DataFrame objects, +Can only compare identically-labeled DataFrame objects, this means DataFrames with identical row and column label. Examples From 1656cd968b8c7310f9a1ebd364d5f96b54a0efbb Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Fri, 31 Jul 2020 12:00:48 +0200 Subject: [PATCH 03/10] [IMP] - #35491 - added explanation about shape --- pandas/core/frame.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 3d34729a54bdf..ea25908180f49 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5898,7 +5898,8 @@ def _construct_result(self, result) -> "DataFrame": Matching NaNs will not appear as a difference. Can only compare identically-labeled DataFrame objects, -this means DataFrames with identical row and column label. +this means DataFrames with the same shape and +identical row and column label. Examples -------- From a91192560907533bf22f9beefddeb5c292a74ad3 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Fri, 31 Jul 2020 12:02:31 +0200 Subject: [PATCH 04/10] [FIX] - #35491 - labelS --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index ea25908180f49..42ef4caf6b730 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5899,7 +5899,7 @@ def _construct_result(self, result) -> "DataFrame": Can only compare identically-labeled DataFrame objects, this means DataFrames with the same shape and -identical row and column label. +identical row and column labels. Examples -------- From f6c683dde80329cc28a2fe42e83370798e327c1e Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Sun, 9 Aug 2020 12:39:51 +0200 Subject: [PATCH 05/10] [FIX] - 35491 - removed add --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 62d55e7d483c6..31ef99118f085 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5901,7 +5901,7 @@ def _construct_result(self, result) -> "DataFrame": Can only compare identically-labeled DataFrame objects, this means DataFrames with the same shape and -identical row and column labels. +identical row, column labels. Examples -------- From 723329e7e16f5862858e585e6a4c4fc369e08d55 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Mon, 31 Aug 2020 14:40:34 +0200 Subject: [PATCH 06/10] added Raises section --- pandas/core/frame.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 31ef99118f085..eb1c790595f10 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5891,17 +5891,22 @@ def _construct_result(self, result) -> "DataFrame": The resulting index will be a MultiIndex with 'self' and 'other' stacked alternately at the inner level. +Raises +------ +ValueError + * When `errors='raise'` and both DataFrames don't have identical labels. + See Also -------- Series.compare : Compare with another Series and show differences. +DataFrame.equals : Test whether two objects contain the same elements. Notes ----- Matching NaNs will not appear as a difference. -Can only compare identically-labeled DataFrame objects, -this means DataFrames with the same shape and -identical row, column labels. +Can only compare identically-labeled DataFrame objects, +this means DataFrames with the same shape and identical row, column labels. Examples -------- From e4d420b17b29127015e42c01e34cbb60b65a7ca2 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Mon, 31 Aug 2020 15:00:21 +0200 Subject: [PATCH 07/10] Fix raise section --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 20a92d698e419..c5898cc134aae 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5935,7 +5935,7 @@ def _construct_result(self, result) -> "DataFrame": Raises ------ ValueError - * When `errors='raise'` and both DataFrames don't have identical labels. + * When both DataFrames don't have identical labels or shape. See Also -------- From c76b41a0d2976fabb17fee140270a20f79501a4f Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Mon, 31 Aug 2020 15:14:23 +0200 Subject: [PATCH 08/10] Removed trailing whitespace --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index c5898cc134aae..4bf4b9d2122c6 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5946,7 +5946,7 @@ def _construct_result(self, result) -> "DataFrame": ----- Matching NaNs will not appear as a difference. -Can only compare identically-labeled DataFrame objects, +Can only compare identically-labeled DataFrame objects, this means DataFrames with the same shape and identical row, column labels. Examples From a1a5f18a742a1824d901417d89176ef026ecedae Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Tue, 1 Sep 2020 18:32:38 +0200 Subject: [PATCH 09/10] Adjustments after review --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 4bf4b9d2122c6..20dff450092dd 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5935,7 +5935,7 @@ def _construct_result(self, result) -> "DataFrame": Raises ------ ValueError - * When both DataFrames don't have identical labels or shape. + When the two DataFrames don't have identical labels or shape. See Also -------- @@ -5946,8 +5946,8 @@ def _construct_result(self, result) -> "DataFrame": ----- Matching NaNs will not appear as a difference. -Can only compare identically-labeled DataFrame objects, -this means DataFrames with the same shape and identical row, column labels. +Can only compare identically-labeled +(i.e. same shape, identical row and column labels) DataFrames Examples -------- From 871794ab6774ebe5b88e0d3a014caf5b9f145401 Mon Sep 17 00:00:00 2001 From: Erfan Nariman Date: Tue, 1 Sep 2020 18:35:28 +0200 Subject: [PATCH 10/10] Removed trailing whitespace --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 20dff450092dd..c1cb24cb9bffa 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5946,7 +5946,7 @@ def _construct_result(self, result) -> "DataFrame": ----- Matching NaNs will not appear as a difference. -Can only compare identically-labeled +Can only compare identically-labeled (i.e. same shape, identical row and column labels) DataFrames Examples