Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.17.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ API changes
Legacy Python syntax (``set([x, y])``) (:issue:`11215`)
- Indexing with a null key will raise a ``TypeError``, instead of a ``ValueError`` (:issue:`11356`)
- ``Series.sort_index()`` now correctly handles the ``inplace`` option (:issue:`11402`)
- ``SparseArray.__iter__()`` now does not cause ``PendingDeprecationWarning`` in Python 3.5 (:issue:`11622`)

- ``DataFrame.itertuples()`` now returns ``namedtuple`` objects, when possible. (:issue:`11269`)
- ``Series.ptp`` will now ignore missing values by default (:issue:`11163`)
Expand Down
1 change: 0 additions & 1 deletion pandas/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def to_dense(self, fill=None):
def __iter__(self):
for i in range(len(self)):
yield self._get_val_at(i)
raise StopIteration

def __getitem__(self, key):
"""
Expand Down
13 changes: 13 additions & 0 deletions pandas/sparse/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np

import operator
import warnings

from pandas.core.series import Series
from pandas.core.common import notnull
Expand Down Expand Up @@ -174,6 +175,18 @@ def _check_roundtrip(obj):
_check_roundtrip(self.arr)
_check_roundtrip(self.zarr)

def test_generator_warnings(self):
sp_arr = SparseArray([1, 2, 3])
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings(action='always',
category=DeprecationWarning)
warnings.filterwarnings(action='always',
category=PendingDeprecationWarning)
for _ in sp_arr:
pass
assert len(w)==0


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
Expand Down