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
Add tests for Series/DataFrame.to_sparse
  • Loading branch information
VikramjeetD committed Jun 9, 2019
commit eede9b8b830165f281b51dfb45aae49f9a706db2
20 changes: 20 additions & 0 deletions pandas/tests/frame/test_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import numpy as np
from numpy import nan
import pytest

import pandas as pd
from pandas import DataFrame
from pandas.core.sparse import frame as spf
from pandas.util import testing as tm


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
def test_deprecated_to_sparse():
df = pd.DataFrame({"A": [1, np.nan, 3]})
sparse_df = pd.SparseDataFrame({"A": [1, np.nan, 3]})

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
result = df.to_sparse()
tm.assert_frame_equal(result, sparse_df)
1 change: 1 addition & 0 deletions pandas/tests/groupby/aggregate/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ def __call__(self, x):
tm.assert_frame_equal(result, expected)


@pytest.mark.filterwarnings("ignore:NDFrame:FutureWarning")
def test_agg_over_numpy_arrays():
# GH 3788
df = pd.DataFrame([[1, np.array([10, 20, 30])],
Expand Down
20 changes: 20 additions & 0 deletions pandas/tests/series/test_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import numpy as np
from numpy import nan
import pytest

import pandas as pd
from pandas import Series
from pandas.core.sparse import series as sps
from pandas.util import testing as tm


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
def test_deprecated_to_sparse():
ser = Series([1, np.nan, 3])
sparse_ser = pd.SparseSeries([1, np.nan, 3])

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
result = ser.to_sparse()
tm.assert_series_equal(result, sparse_ser)
18 changes: 10 additions & 8 deletions pandas/tests/sparse/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,15 +1294,17 @@ def test_default_fill_value_with_no_data(self):
default_fill_value=1.0)
tm.assert_frame_equal(expected, result)

def test_deprecated_to_dense(self):
df = pd.DataFrame({"A": [1, np.nan, 3]})
sparse_df = pd.SparseDataFrame({"A": [1, np.nan, 3]})

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
result = sparse_df.to_dense()
tm.assert_frame_equal(result, df)
#@pytest.mark.filterwarnings("ignore:Series:FutureWarning")
def test_deprecated_to_dense():
df = pd.DataFrame({"A": [1, np.nan, 3]})

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
sparse_df = pd.SparseDataFrame({"A": [1, np.nan, 3]})
result = sparse_df.to_dense()
tm.assert_frame_equal(result, df)


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
Expand Down
20 changes: 11 additions & 9 deletions pandas/tests/sparse/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,15 +1041,6 @@ def test_memory_usage_deep(self, deep, fill_value):

assert sparse_usage < dense_usage

def test_deprecate_to_dense(self):
ser = pd.Series([1, 2, 3])
sparse_ser = pd.SparseSeries([1, 2, 3])

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning):
result = sparse_ser.to_dense()
tm.assert_series_equal(result, ser)


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:Series:FutureWarning")
Expand Down Expand Up @@ -1570,3 +1561,14 @@ def test_block_deprecated():
s = SparseSeries([1])
with tm.assert_produces_warning(FutureWarning):
s.block


@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
def test_deprecate_to_dense():
ser = pd.Series([1, 2, 3])
sparse_ser = pd.SparseSeries([1, 2, 3])

# Deprecated 0.25.0
with tm.assert_produces_warning(FutureWarning):
result = sparse_ser.to_dense()
tm.assert_series_equal(result, ser)
1 change: 1 addition & 0 deletions pandas/tests/test_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def setup_method(self, method):
self.ymd.index.set_names(['year', 'month', 'day'], inplace=True)


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

def test_append(self):
Expand Down