Auxiliary¶
auxiliary
¶
Auxiliary data functions and convenience wrappers.
AuxGetter
¶
Bases: Protocol
Typed callable contract for generated auxiliary table getters.
__call__(version=None, ppp_version=None, release_version=None, api_version=API_VERSION, fmt='json', simplify=True, server=None, dataframe_type='pandas')
¶
Fetch one named auxiliary table.
Source code in src/povineq/auxiliary.py
get_aux(table=None, version=None, ppp_version=None, release_version=None, api_version=API_VERSION, fmt='json', simplify=True, server=None, dataframe_type='pandas', assign_tb=False, replace=False)
¶
Fetch an auxiliary dataset from the PIP API.
When no table is specified, returns a list of available table names.
Mirrors pipr::get_aux().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
str | None
|
Auxiliary table name (e.g. |
None
|
version
|
str | None
|
Data version string. |
None
|
ppp_version
|
int | None
|
PPP base year. |
None
|
release_version
|
str | None
|
Release date in |
None
|
api_version
|
Literal['v1']
|
API version. |
API_VERSION
|
fmt
|
Literal['json', 'csv']
|
Response format — |
'json'
|
simplify
|
bool
|
If |
True
|
server
|
str | None
|
Server target. |
None
|
dataframe_type
|
Literal['pandas', 'polars']
|
|
'pandas'
|
assign_tb
|
bool | str
|
If |
False
|
replace
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
DataFrameLike | list[str] | PIPResponse | bool
|
|
DataFrameLike | list[str] | PIPResponse | bool
|
|
DataFrameLike | list[str] | PIPResponse | bool
|
|
DataFrameLike | list[str] | PIPResponse | bool
|
|
Example
import povineq tables = povineq.get_aux() # list of available tables df = povineq.get_aux("gdp") # fetch GDP table povineq.get_aux("cpi", assign_tb=True) # fetch and store in memory
Source code in src/povineq/auxiliary.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
display_aux(version=None, ppp_version=None, release_version=None, api_version=API_VERSION, fmt='json', simplify=True, server=None)
¶
Display available auxiliary tables.
Fetches the list of auxiliary tables and prints them. Mirrors
pipr::display_aux().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str | None
|
Data version string. |
None
|
ppp_version
|
int | None
|
PPP base year. |
None
|
release_version
|
str | None
|
Release date in |
None
|
api_version
|
Literal['v1']
|
API version. |
API_VERSION
|
fmt
|
Literal['json', 'csv']
|
Response format. |
'json'
|
simplify
|
bool
|
Passed to :func: |
True
|
server
|
str | None
|
Server target. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame | list[str]
|
List of available table name strings. |
Example
import povineq povineq.display_aux()
Source code in src/povineq/auxiliary.py
call_aux(table=None)
¶
Retrieve a previously stored auxiliary table from memory.
Mirrors pipr::call_aux().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
str | None
|
Table name to retrieve. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame | list[str]
|
The stored DataFrame, or a list of stored table names. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the requested table is not in the store. |
Example
import povineq povineq.get_aux("gdp", assign_tb=True) df = povineq.call_aux("gdp")