cudf.core.groupby.groupby.GroupBy.get_group#

GroupBy.get_group(name, obj=None)#

Construct DataFrame from group with provided name.

Parameters:
nameobject

The name of the group to get as a DataFrame.

objDataFrame, default None

The DataFrame to take the DataFrame out of. If it is None, the object groupby was called on will be used.

Returns:
groupsame type as obj

Examples

>>> import cudf
>>> df = cudf.DataFrame({"X": ["A", "B", "A", "B"], "Y": [1, 4, 3, 2]})
>>> df
   X  Y
0  A  1
1  B  4
2  A  3
3  B  2
>>> df.groupby("X").get_group("A")
   X  Y
0  A  1
2  A  3