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
< 8000 /div>
Prev Previous commit
Next Next commit
convert more tests
  • Loading branch information
Matt Roeschke committed Jul 1, 2019
commit 0c82f16818eaa74ff8663603ceb59d3495e66317
7 changes: 3 additions & 4 deletions pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ def test_apply_with_mixed_dtype():
# GH3480, apply with mixed dtype on axis=1 breaks in 0.11
df = DataFrame({'foo1': np.random.randn(6),
'foo2': ['one', 'two', 'two', 'three', 'one', 'two']})
result = df.apply(lambda x: x, axis=1)
tm.assert_series_equal(Series(df._data.get_dtype_counts()),
Series(result._data.get_dtype_counts())
)
result = df.apply(lambda x: x, axis=1).dtypes
expected = df.dtypes
tm.assert_series_equal(result, expected)

# GH 3610 incorrect dtype conversion with as_index=False
df = DataFrame({"c1": [1, 2, 6, 6, 8]})
Expand Down
14 changes: 6 additions & 8 deletions pandas/tests/series/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,19 @@ def test_ser_flex_cmp_return_dtypes(self, opname):
# GH#15115
ser = Series([1, 3, 2], index=range(3))
const = 2

result = Series(
getattr(ser, opname)(const)._data.get_dtype_counts()
)
tm.assert_series_equal(result, Series([1], ['bool']))
result = getattr(ser, opname)(const).dtypes
expected = np.dtype('bool')
assert result == expected

@pytest.mark.parametrize('opname', ['eq', 'ne', 'gt', 'lt', 'ge', 'le'])
def test_ser_flex_cmp_return_dtypes_empty(self, opname):
# GH#15115 empty Series case
ser = Series([1, 3, 2], index=range(3))
empty = ser.iloc[:0]
const = 2

result = Series(getattr(empty, opname)(const)._data.get_dtype_counts())
tm.assert_series_equal(result, Series([1], ['bool']))
result = getattr(empty, opname)(const).dtypes
expected = np.dtype('bool')
assert result == expected

@pytest.mark.parametrize('op', [operator.eq, operator.ne,
operator.le, operator.lt,
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/sparse/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def test_corr(self, float_frame):

def test_describe(self, float_frame):
float_frame['foo'] = np.nan
Series(float_frame._data.get_dtype_counts())
float_frame.dtypes.value_counts()
str(float_frame)
desc = float_frame.describe() # noqa

Expand Down
0