select_suffix
select_suffix(data=None, suffix=None, keep=None)Select identifier and suffixed columns.
The mirror of select_prefix(): keeps a handful of id columns plus every column sharing a suffix in one call. Some questionnaire blocks are marked by a trailing tag rather than a leading one (_com open-text follow-ups, _score derived columns). Order is keep first, then the suffix-matching columns in their original order.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | pandas.DataFrame | A data frame. If omitted, the session default is used. | None |
| suffix | str or list of str | One or more column-name suffixes to keep (e.g. “_com”). | None |
| keep | str or list of str | Additional column names to retain in front of the suffixed block. | None |
Returns
| Name | Type | Description |
|---|---|---|
| pandas.DataFrame | The keep columns followed by all suffix-matching columns. |
See Also
select_prefix, read_folder
Examples
>>> select_suffix(podracing_survey, "_com", keep="respondent_id")