8000 DEPR: DataFrame.get_dtype_counts by mroeschke · Pull Request #27145 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DEPR: DataFrame.get_dtype_counts #27145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Flake8
  • Loading branch information
Matt Roeschke committed Jun 30, 2019
commit 84738855821caa529240254fd92814ed84db41c7
18 changes: 9 additions & 9 deletions pandas/tests/frame/test_mutate_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,22 @@ def test_insert(self):
# new item
df['x'] = df['a'].astype('float32')
result = Series(dict(float32=1, float64=5))
assert (
Series(df._data.get_dtype_counts()).sort_index() == result
).all()
assert (Series(
df._data.get_dtype_counts()
).sort_index() == result).all()

# replacing current (in different block)
df['a'] = df['a'].astype('float32')
result = Series(dict(float32=2, float64=4))
assert (
Series(df._data.get_dtype_counts()).sort_index() == result
).all()
assert (Series(
df._data.get_dtype_counts()
).sort_index() == result).all()

df['y'] = df['a'].astype('int32')
result = Series(dict(float32=2, float64=4, int32=1))
assert (
Series(df._data.get_dtype_counts()).sort_index() == result
).all()
assert (Series(
df._data.get_dtype_counts()
).sort_index() == result).all()

with pytest.raises(ValueError, match='already exists'):
df.insert(1, 'a', df['b'])
Expand Down
10 changes: 6 additions & 4 deletions pandas/tests/reshape/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ def test_basic_types(self, sparse, dtype):
expected_counts[dtype_name] = 3 + expected_counts.get(dtype_name, 0)

expected = Series(expected_counts).sort_index()
tm.assert_series_equal(Series(
result._data.get_dtype_counts()
).sort_index(),
expected)
tm.assert_series_equal(
Series(
result._data.get_dtype_counts()
).sort_index(),
expected
)

def test_just_na(self, sparse):
just_na_list = [np.nan]
Expand Down
8 changes: 6 additions & 2 deletions pandas/tests/series/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ def test_dtype(self, datetime_series):
# GH 26705 - Assert .ftypes is deprecated
with tm.assert_produces_warning(FutureWarning):
assert datetime_series.ftypes == 'float64:dense'
tm.assert_series_equal(Series(datetime_series._data.get_dtype_counts()),
Series(1, ['float64']))
tm.assert_series_equal(
Series(
datetime_series._data.get_dtype_counts()
),
Series(1, ['float64'])
)
# GH18243 - Assert .get_ftype_counts is deprecated
with tm.assert_produces_warning(FutureWarning):
tm.assert_series_equal(datetime_series.get_ftype_counts(),
Expand Down
0