DOC: Correct Series.nonzero docstring
State: closed

The function returns indices, not a boolean array. The description now
matches `numpy.nonzero`.


Labels:
name: Docs

Comments:
this is actually just returning `np.nonzero` on the underlying array, so it should be closer to: http://docs.scipy.org/doc/numpy/reference/generated/numpy.nonzero.html (aside from the pointer in the doc).

this was just for compatibility with numpy, but actually should prob change this to not return the tuple, and instead just return the indices:

```
In [1]: Series([0,1,2]).nonzero()
Out[1]: (array([1, 2]),)
```

since  Series by definition only has 1 dim, I think just returning the array directly is fine (and not the tuple).

want to do a pull-request? (its possible this breaks something as well internally), not sure.

> want to do a pull-request? (its possible this breaks something as well internally), not sure.

Sure. I'll test it out later tonight.

Returning an array instead of the tuple will cause quite a few errors in the tests.

Below are grep results for nonzero calls. I think the main issue in changing some of these is that, in the cases where nonzero is called on arguments, it's nice to be able to process series and arrays in the same way instead of worrying about extra checking or restrictring the arguments to series. And for users, it's also probably a good thing to be able to treat nonzero calls on series and ndarrays the same. It doesn't seem like the convenience of receiving an array back is worth deviating from numpy's behavior (though it might be worth adding a new method that returns an array or maybe an Index).

What do you think?

```
pandas/algos.pyx:516:        valid_locs = (~mask).nonzero()[0]
pandas/core/frame.py:1716:            indexer = key.nonzero()[0]
pandas/core/frame.py:2023:            indexer = key.nonzero()[0]
pandas/core/frame.py:2570:            result = self.take(mask.nonzero()[0], axis=axis, convert=False)
pandas/core/frame.py:2601:            inds, = (-duplicated).nonzero()
pandas/core/generic.py:1428:                    inds, = loc.nonzero()
pandas/core/index.py:1199:            indexer, = (indexer == -1).nonzero()
pandas/core/index.py:1270:            indexer = indexer.take((indexer != -1).nonzero()[0])
pandas/core/index.py:2381:        w, = self._isnan.nonzero()
pandas/core/index.py:4314:            sought_labels = levs.isin(values).nonzero()[0]
pandas/core/indexing.py:943:            inds, = key.nonzero()
pandas/core/indexing.py:1087:                inds, = obj.nonzero()
pandas/core/indexing.py:1197:        inds, = key.nonzero()
pandas/core/internals.py:481:            mask[filtered_out.nonzero()[0]] = False
pandas/core/internals.py:1043:                    result.take(m.nonzero()[0], axis=axis))
pandas/core/internals.py:1550:            filt = self.mgr_locs.isin(filter).nonzero()[0]
pandas/core/internals.py:2887:            affected_start = is_deleted.nonzero()[0][0]
pandas/core/internals.py:2892:            blk_del = is_deleted[bml.indexer].nonzero()[0]
pandas/core/internals.py:4364:        nz = counts.nonzero()[0]
pandas/core/reshape.py:160:                inds = (value_mask.sum(0) > 0).nonzero()[0]
pandas/core/series.py:340:        return self.values.nonzero()
pandas/sparse/panel.py:322:        inds, = mask.nonzero()
pandas/tools/merge.py:224:                        na_indexer = (left_indexer == -1).nonzero()[0]
pandas/tools/merge.py:233:                        na_indexer = (right_indexer == -1).nonzero()[0]
pandas/tools/merge.py:249:                na_indexer = (left_indexer == -1).nonzero()[0]
pandas/tseries/converter.py:444:    return (current - previous).nonzero()[0]
pandas/tseries/converter.py:704:    year_start = (dates_ % 12 == 0).nonzero()[0]
pandas/tseries/converter.py:723:        quarter_start = (dates_ % 3 == 0).nonzero()
pandas/tseries/converter.py:741:        quarter_start = (dates_ % 3 == 0).nonzero()
pandas/tseries/converter.py:774:    year_start = (dates_ % 4 == 0).nonzero()[0]
pandas/tseries/index.py:1226:        return (lhs_mask & rhs_mask).nonzero()[0]
pandas/tseries/index.py:1707:        return (micros == time_micros).nonzero()[0]
pandas/tseries/index.py:1760:        return mask.nonzero()[0]
pandas/tseries/tools.py:172:    non_nan_elements = com.notnull(arr).nonzero()[0]
pandas/tslib.pyx:2289:                switch_idx = (delta<=0).nonzero()[0]
```

hah didn't think was used that much internally on a series. ok

back to plan a - doc it and done

thanks 

OK. I've pushed an update with an expanded docstring.

thanks @kyleam