8000 TST: further clean up of frame/test_analytics by h-vetinari · Pull Request #23016 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST: further clean up of frame/test_analytics #23016

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 5 commits into from
Oct 7, 2018
Merged
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
Final touches
  • Loading branch information
h-vetinari committed Oct 6, 2018
commit a7274b92a0f04806d913d17fa1cd8f9748085de6
9 changes: 4 additions & 5 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def assert_stat_op_calc(opname, alternative, main_frame, has_skipna=True,

if check_dates:
df = DataFrame({'b': date_range('1/1/2001', periods=2)})
_f = getattr(df, opname)
result = _f()
result = getattr(df, opname)()
assert isinstance(result, Series)

df['a'] = lrange(len(df))
Expand Down Expand Up @@ -86,7 +85,7 @@ def wrapper(x):
r0 = getattr(all_na, opname)(axis=0)
r1 = getattr(all_na, opname)(axis=1)
if opname in ['sum', 'prod']:
unit = int(opname == 'prod')
unit = 1 if opname == 'prod' else 0 # result for empty sum/prod
expected = pd.Series(unit, index=r0.index, dtype=r0.dtype)
tm.assert_series_equal(r0, expected)
expected = pd.Series(unit, index=r1.index, dtype=r1.dtype)
Expand Down Expand Up @@ -137,7 +136,7 @@ def wrapper(x):
check_dtype=False)

# bad axis
pytest.raises(ValueError, f, axis=2)
tm.assert_raises_regex(ValueError, 'No axis named 2', f, axis=2)

# all NA case
if has_skipna:
Expand All @@ -156,7 +155,7 @@ def assert_bool_op_api(opname, bool_frame_with_na, float_string_frame,
has_bool_only=False):
# make sure op works on mixed-type frame
mixed = float_string_frame
mixed['_bool_'] = np.random.randn(len(mixed)) > 0
mixed['_bool_'] = np.random.randn(len(mixed)) > 0.5
getattr(mixed, opname)(axis=0)
getattr(mixed, opname)(axis=1)

Expand Down
0