Skip to content

Commit 4ef0312

Browse files
committed
updates based on feedback from @mroeschke
1 parent 09ad390 commit 4ef0312

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ Interval
546546
Indexing
547547
^^^^^^^^
548548
- Bug in :meth:`DataFrame.__getitem__` returning modified columns when called with ``slice`` in Python 3.12 (:issue:`57500`)
549-
- Bug in :meth:`DataFrame.from_records()` throwing a ValueError when passed an empty list as an index (:issue:`58594`)
549+
- Bug in :meth:`DataFrame.from_records` throwing a ``ValueError`` when passed an empty list in ``index`` (:issue:`58594`)
550550
-
551551

552552
Missing

pandas/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7476,7 +7476,7 @@ def ensure_index_from_sequences(sequences, names=None) -> Index:
74767476
from pandas.core.indexes.multi import MultiIndex
74777477

74787478
if len(sequences) == 0:
7479-
return []
7479+
return Index([])
74807480
elif len(sequences) == 1:
74817481
if names is not None:
74827482
names = names[0]

pandas/tests/frame/constructors/test_from_records.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def test_from_records_sequencelike_empty(self):
148148
assert len(result) == 0
149149
assert len(result.columns) == 0
150150

151+
def test_from_records_sequencelike_empty_index(self):
151152
result = DataFrame.from_records([], index=[])
152153
assert len(result) == 0
153154
assert len(result.columns) == 0

0 commit comments

Comments
 (0)