I found this recipe to keep finite entries in my dataframe.
The formula is:
df[df == np.Inf] = np.NaN
df.dropna()
However, when I try it:
In: df[df == np.Inf] = np.NaN
## -- End pasted text --
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-88eed8630e79> in <module>()
----> 1 df[df == np.Inf] = np.NaN
/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/frame.pyc in __setitem__(self, key, value)
/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/frame.pyc in _setitem_frame(self, key, value)
TypeError: Cannot do boolean setting on mixed-type frame
Are there any better recipes to filter rows so that we only keep finite entries in a specific column?