IBGE Data
ipca_indexes(start, end)
Retrieves the IPCA index values for a specified date range.
Makes an API call to the IBGE's data portal using the format: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/YYYYMM-YYYYMM/variaveis/2266?localidades=N1[all]
Example: For the date range "01-01-2024" to "31-03-2024", the API URL will be: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/202401-202403/variaveis/2266?localidades=N1[all]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
DateScalar
|
The start date of the date range |
required |
end
|
DateScalar
|
The end date of the date range |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame with columns 'Period' and 'Value' |
Examples:
>>> from pyield import ibge
>>> # Get the IPCA indexes for the first quarter of 2024
>>> df = ibge.ipca_indexes("01-01-2024", "31-03-2024")
Source code in pyield/ibge/ipca.py
ipca_last_indexes(num_months=1)
Retrieves the last IPCA index values for a specified number of months.
Makes an API call to the IBGE's data portal using the format: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/-N/variaveis/2266?localidades=N1[all]
Example: For the last 2 months, the API URL will be: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/-2/variaveis/2266?localidades=N1[all]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_months
|
int
|
Number of months to retrieve. Defaults to 1. |
1
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame with columns 'Period' and 'Value' |
Raises:
Type | Description |
---|---|
ValueError
|
If num_months is 0 |
Examples:
>>> from pyield import ibge
>>> # Get the last month's IPCA index
>>> df = ibge.ipca_last_indexes(1)
>>> # Get the last 3 months' IPCA indexes
>>> df = ibge.ipca_last_indexes(3)
Source code in pyield/ibge/ipca.py
ipca_last_rates(num_months=1)
Retrieves the last IPCA monthly rates for a specified number of months.
Makes an API call to the IBGE's data portal using the format: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/-N/variaveis/63?localidades=N1[all]
Example: For the last 2 months, the API URL will be: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/-2/variaveis/63?localidades=N1[all]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_months
|
int
|
Number of months to retrieve. Defaults to 1. |
1
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame with columns 'Period' and 'Value' |
Raises:
Type | Description |
---|---|
ValueError
|
If num_months is 0 |
Examples:
>>> from pyield import ibge
>>> # Get the last month's IPCA rate
>>> df = ibge.ipca_last_rates(1)
>>> # Get the last 3 months' IPCA rates
>>> df = ibge.ipca_last_rates(3)
Source code in pyield/ibge/ipca.py
ipca_rates(start, end)
Retrieves the IPCA monthly rates for a specified date range.
Makes an API call to the IBGE's data portal using the format: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/YYYYMM-YYYYMM/variaveis/63?localidades=N1[all]
Example: For the date range "01-01-2024" to "31-03-2024", the API URL will be: https://servicodados.ibge.gov.br/api/v3/agregados/6691/periodos/202401-202403/variaveis/63?localidades=N1[all]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
DateScalar
|
The start date of the date range |
required |
end
|
DateScalar
|
The end date of the date range |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame with columns 'Period' and 'Rate' |
Examples:
>>> from pyield import ibge
>>> # Get the IPCA rates for the first quarter of 2024
>>> df = ibge.ipca_rates("01-01-2024", "31-03-2024")