Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a71737c
Deprecate Series/Dataframe.to_dense/to_sparse()
VikramjeetD Jun 5, 2019
fc08e93
Update series.py
VikramjeetD Jun 5, 2019
82c713d
Beautify
VikramjeetD Jun 5, 2019
39230d4
Beautify
VikramjeetD Jun 5, 2019
1e7c0e8
Beautify
VikramjeetD Jun 7, 2019
e68826c
Update Deprecated SparseDF/Series tests
VikramjeetD Jun 7, 2019
20b8962
Beautify
VikramjeetD Jun 8, 2019
50d0534
Deprecate NDFrame.to_dense
VikramjeetD Jun 8, 2019
933162d
Beautify
VikramjeetD Jun 8, 2019
dd1e6c2
Silence test time deprecation warnings
VikramjeetD Jun 8, 2019
c7f27fd
Beautify
VikramjeetD Jun 8, 2019
be14520
Propose changes to certain tests
VikramjeetD Jun 8, 2019
b12e447
Propose changes to tests. IGNORE PREV COMMIT.
VikramjeetD Jun 8, 2019
2d4de51
Silence test time deprecation warnings
VikramjeetD Jun 9, 2019
eede9b8
Add tests for Series/DataFrame.to_sparse
VikramjeetD Jun 9, 2019
0b08795
Beautify
VikramjeetD Jun 9, 2019
5182a1f
Modify test time warning silence
VikramjeetD Jun 12, 2019
15909c5
Modify groupby ops to remove NDFrame test warnings and add wcatch for…
VikramjeetD Jun 17, 2019
104c12a
Remove filterwarning from test_hist_method.py
VikramjeetD Jun 17, 2019
e713fb0
Update sparsearray test_arithmetics warning
VikramjeetD Jun 17, 2019
587b14f
Remove filterwarning from test_decimal.py
VikramjeetD Jun 17, 2019
1318676
Beautify
VikramjeetD Jun 17, 2019
9043e03
Merge branch 'master' of https://github.com/IntEll1gent/pandas
VikramjeetD Jun 17, 2019
58c678a
Beautify
VikramjeetD Jun 17, 2019
ca14ac1
Merge branch 'master' of https://github.com/IntEll1gent/pandas
VikramjeetD Jun 17, 2019
0c8f287
Update test warnings
VikramjeetD Jun 17, 2019
871ccff
Merge remote-tracking branch 'upstream/master'
VikramjeetD Jun 17, 2019
a8f6c56
Update pandas/core/generic.py
VikramjeetD Jun 17, 2019
72aaca5
Merge branch 'master' of https://github.com/IntEll1gent/pandas
VikramjeetD Jun 17, 2019
6a6e333
Update test time warnings and rectify df/series.to_sparse double warn…
VikramjeetD Jun 17, 2019
4e67856
Update more test time warnings
VikramjeetD Jun 17, 2019
4a3181b
Update test warnings
VikramjeetD Jun 17, 2019
a546a89
Update test warnings
VikramjeetD Jun 17, 2019
5fdb2f8
Revert minor changes
VikramjeetD Jun 17, 2019
a627828
Change location of Series/df.test_deprecated_to_sparse
VikramjeetD Jun 18, 2019
3d36430
Remove SDF/SS.to_dense depr:class already deprecated
VikramjeetD Jun 18, 2019
9f888c5
Add whatsnew entry
VikramjeetD Jun 18, 2019
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
Silence test time deprecation warnings
  • Loading branch information
VikramjeetD committed Jun 8, 2019
commit dd1e6c2c230f7330a9e38961c1cb477bd570872b
1 change: 1 addition & 0 deletions pandas/tests/arrays/sparse/test_arithmetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:Series:FutureWarning")
class TestSparseArrayArithmetics:

_base = np.array
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/arrays/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ def test_cross_type_arithmetic():
tm.assert_series_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('op', ['sum', 'min', 'max', 'prod'])
def test_preserve_dtypes(op):
# TODO(#22346): preserve Int64 dtype
Expand All @@ -684,6 +685,7 @@ def test_preserve_dtypes(op):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('op', ['mean'])
def test_reduce_to_float(op):
# some reduce ops always return float, even if the result
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/extension/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class TestSetitem(BaseDatetimeTests, base.BaseSetitemTests):
pass


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestGroupby(BaseDatetimeTests, base.BaseGroupbyTests):
pass

Expand Down
1 change: 1 addition & 0 deletions pandas/tests/extension/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class TestCasting(base.BaseCastingTests):
pass


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestGroupby(base.BaseGroupbyTests):
pass

Expand Down
1 change: 1 addition & 0 deletions pandas/tests/extension/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class TestGetitem(BaseInterval, base.BaseGetitemTests):
pass


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestGrouping(BaseInterval, base.BaseGroupbyTests):
pass

Expand Down
1 change: 1 addition & 0 deletions pandas/tests/extension/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def test_take_series(self, data):
super().test_take_series(data)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestGroupby(BaseNumPyTests, base.BaseGroupbyTests):
@skip_nested
def test_groupby_extension_apply(
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/extension/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class TestSetitem(BasePeriodTests, base.BaseSetitemTests):
pass


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestGroupby(BasePeriodTests, base.BaseGroupbyTests):
pass

Expand Down
1 change: 1 addition & 0 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ def test_sem(self, datetime_frame):
result = nanops.nansem(arr, axis=0)
assert not (result < 0).any()

@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@td.skip_if_no_scipy
def test_kurt(self):
index = MultiIndex(levels=[['bar'], ['one', 'two', 'three'], [0, 1]],
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/groupby/aggregate/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_agg_regression1(tsframe):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_must_agg(df):
grouped = df.groupby('A')['C']

Expand All @@ -31,6 +32,7 @@ def test_agg_must_agg(df):
grouped.agg(lambda x: x.index[:2])


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_ser_multi_key(df):
# TODO(wesm): unused
ser = df.C # noqa
Expand Down Expand Up @@ -145,6 +147,7 @@ def test_aggregate_str_func(tsframe, groupbyfunc):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_aggregate_item_by_item(df):
grouped = df.groupby('A')

Expand Down Expand Up @@ -172,6 +175,7 @@ def aggfun(ser):
assert len(result) == 0


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_wrap_agg_out(three_group):
grouped = three_group.groupby(['A', 'B'])

Expand Down Expand Up @@ -210,6 +214,7 @@ def test_multiple_functions_tuples_and_non_tuples(df):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_multiple_functions_too_many_lambdas(df):
grouped = df.groupby('A')
funcs = ['mean', lambda x: x.mean(), lambda x: x.std()]
Expand All @@ -219,6 +224,7 @@ def test_agg_multiple_functions_too_many_lambdas(df):
grouped.agg(funcs)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_more_flexible_frame_multi_function(df):
grouped = df.groupby('A')

Expand Down Expand Up @@ -287,6 +293,7 @@ def test_multi_function_flexible_mix(df):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_groupby_agg_coercing_bools():
# issue 14873
dat = pd.DataFrame(
Expand Down Expand Up @@ -316,6 +323,7 @@ def test_order_aggregate_multiple_funcs():
tm.assert_index_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('dtype', [np.int64, np.uint64])
@pytest.mark.parametrize('how', ['first', 'last', 'min',
'max', 'mean', 'median'])
Expand All @@ -329,6 +337,7 @@ def test_uint64_type_handling(dtype, how):
tm.assert_frame_equal(result, expected, check_exact=True)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
class TestNamedAggregation:

def test_agg_relabel(self):
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/groupby/aggregate/test_cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def test_cython_fail_agg():
tm.assert_series_equal(summed, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('op, targop', [
('mean', np.mean),
('median', np.median),
Expand All @@ -148,6 +149,7 @@ def test__cython_agg_general(op, targop):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('op, targop', [
('mean', np.mean),
('median', lambda x: np.median(x) if len(x) > 0 else np.nan),
Expand Down
13 changes: 13 additions & 0 deletions pandas/tests/groupby/aggregate/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from pandas.io.formats.printing import pprint_thing


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_api():
# GH 6337
# http://stackoverflow.com/questions/21706030/pandas-groupby-agg-function-column-dtype-error
Expand Down Expand Up @@ -83,6 +84,7 @@ def test_agg_period_index():
list(grouped)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_dict_parameter_cast_result_dtypes():
# GH 12821

Expand Down Expand Up @@ -121,6 +123,7 @@ def test_agg_dict_parameter_cast_result_dtypes():
tm.assert_series_equal(grouped.time.count(), exp)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_cast_results_dtypes():
# similar to GH12821
# xref #11444
Expand Down Expand Up @@ -291,6 +294,7 @@ def test_agg_nested_dicts():
tm.assert_frame_equal(result, expected, check_like=True)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_item_by_item_raise_typeerror():
df = DataFrame(np.random.randint(10, size=(20, 10)))

Expand All @@ -312,6 +316,7 @@ def test_series_agg_multikey():
tm.assert_series_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_series_agg_multi_pure_python():
data = DataFrame(
{'A': ['foo', 'foo', 'foo', 'foo', 'bar', 'bar', 'bar', 'bar',
Expand All @@ -333,6 +338,7 @@ def bad(x):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_consistency():
# agg with ([]) and () not consistent
# GH 6715
Expand All @@ -356,6 +362,7 @@ def P1(a):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_callables():
# GH 7929
df = DataFrame({'foo': [1, 2], 'bar': [3, 4]}).astype(np.int64)
Expand Down Expand Up @@ -396,6 +403,7 @@ def test_agg_over_numpy_arrays():
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_timezone_round_trip():
# GH 15426
ts = pd.Timestamp("2016-01-01 12:00:00", tz='US/Pacific')
Expand Down Expand Up @@ -427,6 +435,7 @@ def test_agg_timezone_round_trip():
assert ts == grouped.apply(lambda x: x.iloc[-1])[0]


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_sum_uint64_overflow():
# see gh-14758
# Convert to uint64 and don't overflow
Expand All @@ -447,6 +456,7 @@ def test_sum_uint64_overflow():
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize("structure, expected", [
(tuple, pd.DataFrame({'C': {(1, 1): (1, 1, 1), (3, 4): (3, 4, 4)}})),
(list, pd.DataFrame({'C': {(1, 1): [1, 1, 1], (3, 4): [3, 4, 4]}})),
Expand All @@ -465,6 +475,7 @@ def test_agg_structs_dataframe(structure, expected):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize("structure, expected", [
(tuple, pd.Series([(1, 1, 1), (3, 4, 4)], index=[1, 3], name='C')),
(list, pd.Series([[1, 1, 1], [3, 4, 4]], index=[1, 3], name='C')),
Expand Down Expand Up @@ -500,6 +511,7 @@ def test_agg_category_nansum(observed):
tm.assert_series_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_list_like_func():
# GH 18473
df = pd.DataFrame({'A': [str(x) for x in range(3)],
Expand All @@ -511,6 +523,7 @@ def test_agg_list_like_func():
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_lambda_with_timezone():
# GH 23683
df = pd.DataFrame({
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def desc3(group):
assert result3.index.names == ('A', 'B', None)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_apply_series_to_frame():
def f(piece):
with np.errstate(invalid='ignore'):
Expand All @@ -277,6 +278,7 @@ def f(piece):
tm.assert_index_equal(result.index, ts.index)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_apply_series_yield_constant(df):
result = df.groupby(['A', 'B'])['C'].apply(len)
assert result.index.names[:2] == ('A', 'B')
Expand All @@ -301,6 +303,7 @@ def test_apply_frame_to_series(df):
tm.assert_numpy_array_equal(result.values, expected.values)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_apply_frame_concat_series():
def trans(group):
return group.groupby('B')['C'].sum().sort_values()[:2]
Expand All @@ -319,6 +322,7 @@ def trans2(group):
assert result.name == 'C'


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_apply_transform(ts):
grouped = ts.groupby(lambda x: x.month)
result = grouped.apply(lambda x: x * 2)
Expand Down
5 changes: 5 additions & 0 deletions pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def f(a):
return result.reindex(index).sort_index()


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_apply_use_categorical_name(df):
cats = qcut(df.C, 4)

Expand All @@ -43,6 +44,7 @@ def get_stats(group):
assert result.index.names[0] == 'C'


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_basic():

cats = Categorical(["a", "a", "a", "b", "b", "b", "c", "c", "c"],
Expand Down Expand Up @@ -991,6 +993,7 @@ def df_cat(df):
return df_cat


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('operation, kwargs', [
('agg', dict(dtype='category')),
('apply', dict())])
Expand All @@ -1006,6 +1009,7 @@ def test_seriesgroupby_observed_true(df_cat, operation, kwargs):
assert_series_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize('operation', ['agg', 'apply'])
@pytest.mark.parametrize('observed', [False, None])
def test_seriesgroupby_observed_false_or_none(df_cat, observed, operation):
Expand All @@ -1022,6 +1026,7 @@ def test_seriesgroupby_observed_false_or_none(df_cat, observed, operation):
assert_series_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
@pytest.mark.parametrize("observed, index, data", [
(True, MultiIndex.from_tuples(
[('foo', 'one', 'min'), ('foo', 'one', 'max'),
Expand Down
Loading