4.7.7.1.2.3. statsmodels.tools.grouputils.Grouping¶
-
class
statsmodels.tools.grouputils.
Grouping
(index, names=None)[source]¶ - index : index-like
- Can be pandas MultiIndex or Index or array-like. If array-like and is a MultipleIndex (more than one grouping variable), groups are expected to be in each row. E.g., [(‘red’, 1), (‘red’, 2), (‘green’, 1), (‘green’, 2)]
- names : list or str, optional
- The names to use for the groups. Should be a str if only one grouping variable is used.
Notes
If index is already a pandas Index then there is no copy.
-
__init__
(index, names=None)[source]¶ - index : index-like
- Can be pandas MultiIndex or Index or array-like. If array-like and is a MultipleIndex (more than one grouping variable), groups are expected to be in each row. E.g., [(‘red’, 1), (‘red’, 2), (‘green’, 1), (‘green’, 2)]
- names : list or str, optional
- The names to use for the groups. Should be a str if only one grouping variable is used.
Notes
If index is already a pandas Index then there is no copy.
4.7.7.1.2.3.1. Methods¶
__init__ (index[, names]) |
index : index-like |
check_index ([is_sorted, unique, index]) |
Sanity checks |
count_categories ([level]) |
Sets the attribute counts to equal the bincount of the (integer-valued) labels. |
dummies_groups ([level]) |
|
dummies_time () |
|
dummy_sparse ([level]) |
create a sparse indicator from a group array with integer labels |
get_slices ([level]) |
Sets the slices attribute to be a list of indices of the sorted groups for the first index level. |
reindex ([index, names]) |
Resets the index in-place. |
sort (data[, index]) |
Applies a (potentially hierarchical) sort operation on a numpy array or pandas series/dataframe based on the grouping index or a user-supplied index. |
transform_array (array, function[, level]) |
Apply function to each column, by group |
transform_dataframe (dataframe, function[, level]) |
Apply function to each column, by group |
transform_slices (array, function[, level]) |
Apply function to each group. |
4.7.7.1.2.3.2. Attributes¶
group_names |
|
index_shape |
|
labels |
|
levels |