#NEWLINE# @ param . parameterized . bothmethod #NEWLINE# def groupby_python( self_or_cls , ndmapping , dimensions , container_type , group_type , sort = False , **kwargs ) : #NEWLINE# #INDENT# idims = [ dim for dim in ndmapping . kdims if ( dim not in dimensions ) ] #NEWLINE# dim_names = [ dim . name for dim in dimensions ] #NEWLINE# selects = get_unique_keys ( ndmapping , dimensions ) #NEWLINE# selects = group_select ( list ( selects ) ) #NEWLINE# groups = [ ( k , group_type ( ( v . reindex ( idims ) if hasattr ( v , 'kdims' ) else [ ( ( ) , ( v , ) ) ] ) , ** kwargs ) ) for ( k , v ) in iterative_select ( ndmapping , dim_names , selects ) ] #NEWLINE# return container_type ( groups , kdims = dimensions )