Skip to content

Commit 1838f65

Browse files
committed
change DEPRECATED and remove from_items from some constructor tests
1 parent c25f541 commit 1838f65

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

pandas/core/frame.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1246,10 +1246,11 @@ def to_records(self, index=True, convert_datetime64=True):
12461246
@classmethod
12471247
def from_items(cls, items, columns=None, orient='columns'):
12481248
"""
1249-
DEPRECATED: from_items is deprecated and will be removed in a
1250-
future version. Use :meth:`DataFrame.from_dict(dict())`
1251-
instead. :meth:`DataFrame.from_dict(OrderedDict(...))` may be used
1252-
to preserve the key order.
1249+
.. deprecated:: 0.23.0
1250+
from_items is deprecated and will be removed in a
1251+
future version. Use :meth:`DataFrame.from_dict(dict())`
1252+
instead. :meth:`DataFrame.from_dict(OrderedDict(...))` may be used
1253+
to preserve the key order.
12531254
12541255
Convert (key, value) pairs to DataFrame. The keys will be the axis
12551256
index (usually the columns, but depends on the specified

pandas/tests/frame/test_constructors.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -1283,17 +1283,13 @@ def test_constructor_column_duplicates(self):
12831283

12841284
tm.assert_frame_equal(df, edf)
12851285

1286-
with tm.assert_produces_warning(FutureWarning,
1287-
check_stacklevel=False):
1288-
idf = DataFrame.from_items([('a', [8]), ('a', [5])],
1289-
columns=['a', 'a'])
1286+
idf = DataFrame.from_records([(8, 5)],
1287+
columns=['a', 'a'])
1288+
12901289
tm.assert_frame_equal(idf, edf)
12911290

1292-
with tm.assert_produces_warning(FutureWarning,
1293-
check_stacklevel=False):
1294-
pytest.raises(ValueError, DataFrame.from_items,
1295-
[('a', [8]), ('a', [5]), ('b', [6])],
1296-
columns=['b', 'a', 'a'])
1291+
pytest.raises(ValueError, DataFrame.from_dict,
1292+
OrderedDict([('b', 8), ('a', 5), ('a', 6)]))
12971293

12981294
def test_constructor_empty_with_string_dtype(self):
12991295
# GH 9428

0 commit comments

Comments
 (0)