Skip to content

Commit 1535634

Browse files
Update construction.py
1 parent 56a7b3b commit 1535634

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pandas/core/internals/construction.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,10 +743,13 @@ def sanitize_index(data, index: Index):
743743
Sanitize an index type to return an ndarray of the underlying, pass
744744
through a non-Index.
745745
"""
746-
if len(data) > len(index):
747-
raise ValueError("Length of values is greater than length of index")
748-
if len(index) > len(data):
749-
raise ValueError("Length of index is greater than length of values")
746+
if len(data) != len(index):
747+
raise ValueError(
748+
"Length of values"
749+
f" ({len(data)})"
750+
" does not match length of index"
751+
f" ({len(index)})"
752+
)
750753

751754
if isinstance(data, np.ndarray):
752755

0 commit comments

Comments
 (0)