Skip to content

Commit

Permalink
change DEPRECATED and remove from_items from some constructor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reidy-p committed Jan 30, 2018
1 parent c25f541 commit 1838f65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
9 changes: 5 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1838f65

Please sign in to comment.