Pandas: how to get a particular group after groupby?

zer0ne

I want to group a dataframe by a column, called 'A', and inspect certain certain group.

grouped = df.groupby('A', sort=False)

However, I don't know how to access a group, for example, I expect that

grouped.first() 

would give me the first group

Or

grouped['foo'] 

would give me the group A=='foo'.

However, Pandas doesn't work like that.

I couldn't find a similar example online.

CT Zhu

Try: grouped.get_group('foo'), that is what you need.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get last group in Pandas' groupBy?

From Dev

pandas how to groupby a period time and then get back a df after filtration inside the group?

From Dev

How to get a list of index values after groupby().mean() in pandas?

From Dev

Sample each group after pandas groupby

From Java

How to group dataframe rows into list in pandas groupby

From Dev

How to get particular Column of DataFrame in pandas?

From Dev

How do I get the first timestamp (index) of a group when applying groupby to a python pandas dataframe?

From Dev

How to use pandas groupby with aggregation for counting total time taken by a particular event for a particular ID?

From Dev

update pandas.DataFrame within a group after .groupby()

From Dev

How to plot aggregate results after groupby in Pandas?

From Dev

How to access MultiIndex column after groupby in pandas?

From Dev

How to plot aggregate results after groupby in Pandas?

From Dev

How to get the p-value between two groups after groupby in pandas?

From Java

Get statistics for each group (such as count, mean, etc) using pandas GroupBy?

From Dev

pandas get minimum of one column in group when groupby another

From Dev

ASP.NET SignalR: How to get the group name of particular caller?

From Java

Pandas groupby: How to get a union of strings

From Dev

How to get number of groups in a groupby object in pandas?

From Dev

Pandas: sort within groupby on a particular column

From Dev

How to get all p tags after particular class in dom

From Dev

how to apply different functions to each group of pandas groupby?

From Dev

In Pandas, how to apply a customized function using Group mean on Groupby Object

From Dev

How to create a data frame for each group in the pandas.groupby function?

From Dev

How to get the count of particular values in a column using pandas

From Dev

How to get all the historical values for particular days/times in pandas dataframe?

From Dev

How to get the count of particular values in a column using pandas

From Dev

Pandas groupby: get size of a group knowing its id (from .grouper.group_info[0])

From Dev

Pandas groupby sum if value in group

From Dev

Discard group in pandas groupby operation

Related Related

  1. 1

    How to get last group in Pandas' groupBy?

  2. 2

    pandas how to groupby a period time and then get back a df after filtration inside the group?

  3. 3

    How to get a list of index values after groupby().mean() in pandas?

  4. 4

    Sample each group after pandas groupby

  5. 5

    How to group dataframe rows into list in pandas groupby

  6. 6

    How to get particular Column of DataFrame in pandas?

  7. 7

    How do I get the first timestamp (index) of a group when applying groupby to a python pandas dataframe?

  8. 8

    How to use pandas groupby with aggregation for counting total time taken by a particular event for a particular ID?

  9. 9

    update pandas.DataFrame within a group after .groupby()

  10. 10

    How to plot aggregate results after groupby in Pandas?

  11. 11

    How to access MultiIndex column after groupby in pandas?

  12. 12

    How to plot aggregate results after groupby in Pandas?

  13. 13

    How to get the p-value between two groups after groupby in pandas?

  14. 14

    Get statistics for each group (such as count, mean, etc) using pandas GroupBy?

  15. 15

    pandas get minimum of one column in group when groupby another

  16. 16

    ASP.NET SignalR: How to get the group name of particular caller?

  17. 17

    Pandas groupby: How to get a union of strings

  18. 18

    How to get number of groups in a groupby object in pandas?

  19. 19

    Pandas: sort within groupby on a particular column

  20. 20

    How to get all p tags after particular class in dom

  21. 21

    how to apply different functions to each group of pandas groupby?

  22. 22

    In Pandas, how to apply a customized function using Group mean on Groupby Object

  23. 23

    How to create a data frame for each group in the pandas.groupby function?

  24. 24

    How to get the count of particular values in a column using pandas

  25. 25

    How to get all the historical values for particular days/times in pandas dataframe?

  26. 26

    How to get the count of particular values in a column using pandas

  27. 27

    Pandas groupby: get size of a group knowing its id (from .grouper.group_info[0])

  28. 28

    Pandas groupby sum if value in group

  29. 29

    Discard group in pandas groupby operation

HotTag

Archive