Skip to content

lfsir.api.add_classification

Add industry or occupation classification to table.

This function takes a Pandas DataFrame containing ISIC industry codes or ISCO occupation codes, and enriches it by decoding these codes into descriptive categories.

The output DataFrame will contain additional columns with attributes from the classification system at the specified hierarchical levels, providing more information alongside the original coded values.

Parameters:

Name Type Description Default
table DataFrame

Input DataFrame containing the classification code column.

required
target str

Name of the column containing industry or occupation codes.

required
name str

Name of classification to apply.

'original'

Other Parameters:

Name Type Description
aspects list of str

Classification aspects to add as columns, like "label", "farsi_label".

levels list of int

Hierarchy levels to include, like 1 or [1, 2].

column_names list of str

Custom names to use for the added columns.

year_col str

Name of year column for resolving annual changes.

Returns:

Type Description
DataFrame

Input DataFrame with additional columns containing classification attributes.

Examples:

import lfsir
table = lfsir.load_table(years=1401)
table = lfsir.add_classification(table, target="Main_Job_Workplace_ISIC_Code")