Skip to content

Commit b210bd3

Browse files
reidy-pjreback
authored andcommitted
DEPR/CLN: fix from_items deprecation warnings (#19559)
1 parent 7e6e7e4 commit b210bd3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pandas/tests/groupby/aggregate/test_other.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import print_function
88

99
import pytest
10+
from collections import OrderedDict
1011

1112
import datetime as dt
1213
from functools import partial
@@ -81,7 +82,7 @@ def test_agg_period_index():
8182
s1 = Series(np.random.rand(len(index)), index=index)
8283
s2 = Series(np.random.rand(len(index)), index=index)
8384
series = [('s1', s1), ('s2', s2)]
84-
df = DataFrame.from_items(series)
85+
df = DataFrame.from_dict(OrderedDict(series))
8586
grouped = df.groupby(df.index.month)
8687
list(grouped)
8788

pandas/tests/reshape/test_reshape.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from warnings import catch_warnings
55
import pytest
6+
from collections import OrderedDict
67

78
from pandas import DataFrame, Series
89
import pandas as pd
@@ -457,7 +458,8 @@ def test_dataframe_dummies_preserve_categorical_dtype(self, dtype):
457458
@pytest.mark.parametrize('sparse', [True, False])
458459
def test_get_dummies_dont_sparsify_all_columns(self, sparse):
459460
# GH18914
460-
df = DataFrame.from_items([('GDP', [1, 2]), ('Nation', ['AB', 'CD'])])
461+
df = DataFrame.from_dict(OrderedDict([('GDP', [1, 2]),
462+
('Nation', ['AB', 'CD'])]))
461463
df = get_dummies(df, columns=['Nation'], sparse=sparse)
462464
df2 = df.reindex(columns=['GDP'])
463465

0 commit comments

Comments
 (0)