I have a Series like this after doing groupby(\'name\') and used mean() function on other column
name
383 3.000000
663 1.000000
726 1.000000
7
As DACW pointed out, there are method-chaining improvements in pandas 0.18.1 that do what you are looking for very nicely.
Rather than using .where
, you can pass your function to either the .loc
indexer or the Series indexer []
and avoid the call to .dropna
:
test = pd.Series({
383: 3.000000,
663: 1.000000,
726: 1.000000,
737: 9.000000,
833: 8.166667
})
test.loc[lambda x : x!=1]
test[lambda x: x!=1]
Similar behavior is supported on the DataFrame and NDFrame classes.