You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [32]: s=pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'])
In [33]: s.str.startswith('A')
Out[33]:
0True1False2False3True4False5NaN6False7False8FalseIn [34]: s[s.str.startswith('A')]
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-34-f0d46b8c76ff>in<module>()
---->1s[s.str.startswith('A')]
/net/home4/bmueller/.virtualenvs/myenv/lib/python2.6/site-packages/pandas/core/series.pycin__getitem__(self, key)
447# special handling of boolean data with NAs stored in object448# arrays. Since we can't represent NA with dtype=bool-->449if_is_bool_indexer(key):
450key=self._check_bool_indexer(key)
451key=np.asarray(key, dtype=bool)
/net/home4/bmueller/.virtualenvs/myenv/lib/python2.6/site-packages/pandas/core/common.pycin_is_bool_indexer(key)
499ifnotlib.is_bool_array(key):
500ifisnull(key).any():
-->501raiseValueError('cannot index with vector containing '502'NA / NaN values')
503returnFalseValueError: cannotindexwithvectorcontainingNA/NaNvalues
The text was updated successfully, but these errors were encountered:
I wasn't aware of fillna(False) for this case. So I think this is a good solution. Maybe it could be included as an example in the docs and everything is fine.
The text was updated successfully, but these errors were encountered: