Filtering values of a Series in Pandas
Start your free 7-days trial now!
To filter values of a Series in Pandas, pass in a filter function to the
This is equivalent to the following:
def foo(my_series):return my_series > 4s.loc[foo]a 5c 6dtype: int64
my_series > 4 returns the following boolean mask where the values corresponding to
True will be returned in the resulting Series:
a Trueb Falsec Trued Falsedtype: bool