Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

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

737      9.000000

833      8.166667

Could anyone please show me how to filter out the rows with 1.000000 mean values? Thank you and I greatly appreciate your help.

1 Answer

0 votes
by (41.4k points)

Use this below code to filter the series:

import pandas as pd

test = {

383:    3.000000,

663:    1.000000,

726:    1.000000,

737:    9.000000,

833:    8.166667

}

s = pd.Series(test)

s = s[s != 1]

Output:

383    3.000000

737    9.000000

833    8.166667

dtype: float64

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...