From 1838f65bf8ede9b83c3e227b95e50dde3abf4920 Mon Sep 17 00:00:00 2001 From: Paul Reidy Date: Thu, 25 Jan 2018 23:01:35 +0000 Subject: [PATCH] change DEPRECATED and remove from_items from some constructor tests --- pandas/core/frame.py | 9 +++++---- pandas/tests/frame/test_constructors.py | 14 +++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 0995e01238240..96d28581cfdd9 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1246,10 +1246,11 @@ def to_records(self, index=True, convert_datetime64=True): @classmethod def from_items(cls, items, columns=None, orient='columns'): """ - DEPRECATED: from_items is deprecated and will be removed in a - future version. Use :meth:`DataFrame.from_dict(dict())` - instead. :meth:`DataFrame.from_dict(OrderedDict(...))` may be used - to preserve the key order. + .. deprecated:: 0.23.0 + from_items is deprecated and will be removed in a + future version. Use :meth:`DataFrame.from_dict(dict())` + instead. :meth:`DataFrame.from_dict(OrderedDict(...))` may be used + to preserve the key order. Convert (key, value) pairs to DataFrame. The keys will be the axis index (usually the columns, but depends on the specified diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index 732de0c2e968a..8abd88d8a379c 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -1283,17 +1283,13 @@ def test_constructor_column_duplicates(self): tm.assert_frame_equal(df, edf) - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - idf = DataFrame.from_items([('a', [8]), ('a', [5])], - columns=['a', 'a']) + idf = DataFrame.from_records([(8, 5)], + columns=['a', 'a']) + tm.assert_frame_equal(idf, edf) - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - pytest.raises(ValueError, DataFrame.from_items, - [('a', [8]), ('a', [5]), ('b', [6])], - columns=['b', 'a', 'a']) + pytest.raises(ValueError, DataFrame.from_dict, + OrderedDict([('b', 8), ('a', 5), ('a', 6)])) def test_constructor_empty_with_string_dtype(self): # GH 9428