hbsir.api.add_attribute
Add attributes to table based on ID column.
This function takes a Pandas DataFrame containing a household ID column, and enriches it by adding columns indicating attributes like urban/rural status, province, county etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
DataFrame
|
Input DataFrame containing the ID column. |
required |
name
|
_Attribute
|
Name of attribute to add. |
required |
aspects
|
list of str
|
Specific aspects of the attribute to add as columns. |
"name"
|
Other Parameters:
Name | Type | Description |
---|---|---|
column_names |
list of str
|
Custom names to use for the added columns. |
id_col |
str
|
Name of the ID column in the table. |
year_col |
str
|
Name of the year column in the table. |
Returns:
Type | Description |
---|---|
DataFrame
|
Input DataFrame with additional columns containing attribute values. |
Examples: