Skip to content

Commit 4c36db3

Browse files
committed
Merge pull request #8294 from ischwabacher/patch-2
ERR: DataFrame.from_records raises misleading exception on shape mismatch
2 parents fb977d7 + 12413a8 commit 4c36db3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandas/core/internals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3507,7 +3507,7 @@ def create_block_manager_from_arrays(arrays, names, axes):
35073507
mgr._consolidate_inplace()
35083508
return mgr
35093509
except (ValueError) as e:
3510-
construction_error(len(arrays), arrays[0].shape[1:], axes, e)
3510+
construction_error(len(arrays), arrays[0].shape, axes, e)
35113511

35123512

35133513
def form_blocks(arrays, names, axes):

pandas/tests/test_frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4032,7 +4032,7 @@ def test_from_records_to_records(self):
40324032
tm.assert_frame_equal(DataFrame.from_records(arr2), DataFrame(arr2))
40334033

40344034
# wrong length
4035-
msg = r'Shape of passed values is \(3,\), indices imply \(3, 1\)'
4035+
msg = r'Shape of passed values is \(3, 2\), indices imply \(3, 1\)'
40364036
with assertRaisesRegexp(ValueError, msg):
40374037
DataFrame.from_records(arr, index=index[:-1])
40384038

0 commit comments

Comments
 (0)