python-bcb 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_bcb-0.3.0 → python_bcb-0.3.2}/PKG-INFO +2 -2
- {python_bcb-0.3.0 → python_bcb-0.3.2}/README.md +1 -1
- python_bcb-0.3.0/bcb/sgs.py → python_bcb-0.3.2/bcb/sgs/__init__.py +132 -131
- python_bcb-0.3.2/bcb/sgs/regional_economy.py +196 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/utils.py +12 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/pyproject.toml +7 -4
- {python_bcb-0.3.0 → python_bcb-0.3.2}/LICENSE +0 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/__init__.py +0 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/currency.py +0 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/odata/__init__.py +0 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/odata/api.py +0 -0
- {python_bcb-0.3.0 → python_bcb-0.3.2}/bcb/odata/framework.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-bcb
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary:
|
|
5
5
|
Author: wilsonfreitas
|
|
6
6
|
Author-email: wilson.freitas@gmail.com
|
|
@@ -48,7 +48,7 @@ pip install python-bcb
|
|
|
48
48
|
|
|
49
49
|
## SGS
|
|
50
50
|
Utiliza o webservice do SGS
|
|
51
|
-
(
|
|
51
|
+
([Sistema Gerenciador de Séries Temporais](https://www3.bcb.gov.br/sgspub/))
|
|
52
52
|
para obter os dados.
|
|
53
53
|
|
|
54
54
|
## Conversor de Moedas
|
|
@@ -31,7 +31,7 @@ pip install python-bcb
|
|
|
31
31
|
|
|
32
32
|
## SGS
|
|
33
33
|
Utiliza o webservice do SGS
|
|
34
|
-
(
|
|
34
|
+
([Sistema Gerenciador de Séries Temporais](https://www3.bcb.gov.br/sgspub/))
|
|
35
35
|
para obter os dados.
|
|
36
36
|
|
|
37
37
|
## Conversor de Moedas
|
|
@@ -1,131 +1,132 @@
|
|
|
1
|
-
from io import StringIO
|
|
2
|
-
|
|
3
|
-
import requests
|
|
4
|
-
import pandas as pd
|
|
5
|
-
|
|
6
|
-
from .utils import Date
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
Sistema Gerenciador de Séries Temporais (SGS)
|
|
10
|
-
|
|
11
|
-
O módulo ``sgs`` obtem os dados do webservice do Banco Central,
|
|
12
|
-
interface json do serviço BCData/SGS -
|
|
13
|
-
`Sistema Gerenciador de Séries Temporais (SGS)
|
|
14
|
-
<https://www3.bcb.gov.br/sgspub/localizarseries/localizarSeries.do?method=prepararTelaLocalizarSeries>`_.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class SGSCode:
|
|
19
|
-
def __init__(self, code, name=None):
|
|
20
|
-
if name is None:
|
|
21
|
-
if isinstance(code, int) or isinstance(code, str):
|
|
22
|
-
self.name = str(code)
|
|
23
|
-
self.value = int(code)
|
|
24
|
-
else:
|
|
25
|
-
self.name = str(name)
|
|
26
|
-
self.value = int(code)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
yield SGSCode(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
* ``list`` ou ``tuple`` : lista ou tupla com
|
|
85
|
-
* ``
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
série
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
df =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
1
|
+
from io import StringIO
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from bcb.utils import Date
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Sistema Gerenciador de Séries Temporais (SGS)
|
|
10
|
+
|
|
11
|
+
O módulo ``sgs`` obtem os dados do webservice do Banco Central,
|
|
12
|
+
interface json do serviço BCData/SGS -
|
|
13
|
+
`Sistema Gerenciador de Séries Temporais (SGS)
|
|
14
|
+
<https://www3.bcb.gov.br/sgspub/localizarseries/localizarSeries.do?method=prepararTelaLocalizarSeries>`_.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SGSCode:
|
|
19
|
+
def __init__(self, code, name=None):
|
|
20
|
+
if name is None:
|
|
21
|
+
if isinstance(code, int) or isinstance(code, str):
|
|
22
|
+
self.name = str(code)
|
|
23
|
+
self.value = int(code)
|
|
24
|
+
else:
|
|
25
|
+
self.name = str(name)
|
|
26
|
+
self.value = int(code)
|
|
27
|
+
|
|
28
|
+
def __repr__(self):
|
|
29
|
+
return f"{self.code} - {self.name}" if self.name else f"{self.code}"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _codes(codes):
|
|
33
|
+
if isinstance(codes, int) or isinstance(codes, str):
|
|
34
|
+
yield SGSCode(codes)
|
|
35
|
+
elif isinstance(codes, tuple):
|
|
36
|
+
yield SGSCode(codes[1], codes[0])
|
|
37
|
+
elif isinstance(codes, list):
|
|
38
|
+
for cd in codes:
|
|
39
|
+
_ist = isinstance(cd, tuple)
|
|
40
|
+
yield SGSCode(cd[1], cd[0]) if _ist else SGSCode(cd)
|
|
41
|
+
elif isinstance(codes, dict):
|
|
42
|
+
for name, code in codes.items():
|
|
43
|
+
yield SGSCode(code, name)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _get_url_and_payload(code, start_date, end_date, last):
|
|
47
|
+
payload = {"formato": "json"}
|
|
48
|
+
if last == 0:
|
|
49
|
+
if start_date is not None or end_date is not None:
|
|
50
|
+
payload["dataInicial"] = Date(start_date).date.strftime("%d/%m/%Y")
|
|
51
|
+
end_date = end_date if end_date else "today"
|
|
52
|
+
payload["dataFinal"] = Date(end_date).date.strftime("%d/%m/%Y")
|
|
53
|
+
url = "https://api.bcb.gov.br/dados/serie/bcdata.sgs.{}/dados".format(code)
|
|
54
|
+
else:
|
|
55
|
+
url = ("https://api.bcb.gov.br/dados/serie/bcdata.sgs.{}/dados" "/ultimos/{}").format(code, last)
|
|
56
|
+
|
|
57
|
+
return {"payload": payload, "url": url}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _format_df(df, code, freq):
|
|
61
|
+
cns = {"data": "Date", "valor": code.name, "datafim": "enddate"}
|
|
62
|
+
df = df.rename(columns=cns)
|
|
63
|
+
if "Date" in df:
|
|
64
|
+
df["Date"] = pd.to_datetime(df["Date"], format="%d/%m/%Y")
|
|
65
|
+
if "enddate" in df:
|
|
66
|
+
df["enddate"] = pd.to_datetime(df["enddate"], format="%d/%m/%Y")
|
|
67
|
+
df = df.set_index("Date")
|
|
68
|
+
if freq:
|
|
69
|
+
df.index = df.index.to_period(freq)
|
|
70
|
+
return df
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def get(codes, start=None, end=None, last=0, multi=True, freq=None):
|
|
74
|
+
"""
|
|
75
|
+
Retorna um DataFrame pandas com séries temporais obtidas do SGS.
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
|
|
80
|
+
codes : {int, List[int], List[str], Dict[str:int]}
|
|
81
|
+
Este argumento pode ser uma das opções:
|
|
82
|
+
|
|
83
|
+
* ``int`` : código da série temporal
|
|
84
|
+
* ``list`` ou ``tuple`` : lista ou tupla com códigos
|
|
85
|
+
* ``list`` ou ``tuple`` : lista ou tupla com pares ``('nome', código)``
|
|
86
|
+
* ``dict`` : dicionário com pares ``{'nome': código}``
|
|
87
|
+
|
|
88
|
+
Com códigos numéricos é interessante utilizar os nomes com os códigos
|
|
89
|
+
para definir os nomes nas colunas das séries temporais.
|
|
90
|
+
start : str, int, date, datetime, Timestamp
|
|
91
|
+
Data de início da série.
|
|
92
|
+
Interpreta diferentes tipos e formatos de datas.
|
|
93
|
+
end : string, int, date, datetime, Timestamp
|
|
94
|
+
Data final da série.
|
|
95
|
+
Interpreta diferentes tipos e formatos de datas.
|
|
96
|
+
last : int
|
|
97
|
+
Retorna os últimos ``last`` elementos disponíveis da série temporal
|
|
98
|
+
solicitada. Se ``last`` for maior que 0 (zero) os argumentos ``start``
|
|
99
|
+
e ``end`` são ignorados.
|
|
100
|
+
multi : bool
|
|
101
|
+
Define se, quando mais de 1 série for solicitada, a função retorna uma
|
|
102
|
+
série multivariada ou uma lista com séries univariadas.
|
|
103
|
+
freq : str
|
|
104
|
+
Define a frequência a ser utilizada na série temporal
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
|
|
109
|
+
``DataFrame`` :
|
|
110
|
+
série temporal univariada ou multivariada,
|
|
111
|
+
quando solicitado mais de uma série (parâmetro ``multi=True``).
|
|
112
|
+
|
|
113
|
+
``list`` :
|
|
114
|
+
lista com séries temporais univariadas,
|
|
115
|
+
quando solicitado mais de uma série (parâmetro ``multi=False``).
|
|
116
|
+
"""
|
|
117
|
+
dfs = []
|
|
118
|
+
for code in _codes(codes):
|
|
119
|
+
urd = _get_url_and_payload(code.value, start, end, last)
|
|
120
|
+
res = requests.get(urd["url"], params=urd["payload"])
|
|
121
|
+
if res.status_code != 200:
|
|
122
|
+
raise Exception("Download error: code = {}".format(code.value))
|
|
123
|
+
df = pd.read_json(StringIO(res.text))
|
|
124
|
+
df = _format_df(df, code, freq)
|
|
125
|
+
dfs.append(df)
|
|
126
|
+
if len(dfs) == 1:
|
|
127
|
+
return dfs[0]
|
|
128
|
+
else:
|
|
129
|
+
if multi:
|
|
130
|
+
return pd.concat(dfs, axis=1)
|
|
131
|
+
else:
|
|
132
|
+
return dfs
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
from bcb.sgs import get
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Dados da Economia Regional
|
|
5
|
+
|
|
6
|
+
Histórico de taxas de inadimplência das operações de crédito do Sistema Financeiro Nacional para
|
|
7
|
+
pessoas físicas e pessoas jurídicas.
|
|
8
|
+
|
|
9
|
+
Dados disponíveis por região e por estado.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
NON_PERFORMING_LOANS_BY_REGION_PF = {
|
|
13
|
+
"N": "15888",
|
|
14
|
+
"NE": "15889",
|
|
15
|
+
"CO": "15890",
|
|
16
|
+
"SE": "15891",
|
|
17
|
+
"S": "15892",
|
|
18
|
+
}
|
|
19
|
+
NON_PERFORMING_LOANS_BY_STATE_PF = {
|
|
20
|
+
"AC": "15861",
|
|
21
|
+
"AL": "15862",
|
|
22
|
+
"AP": "15863",
|
|
23
|
+
"AM": "15864",
|
|
24
|
+
"BA": "15865",
|
|
25
|
+
"CE": "15866",
|
|
26
|
+
"DF": "15867",
|
|
27
|
+
"ES": "15868",
|
|
28
|
+
"GO": "15869",
|
|
29
|
+
"MA": "15870",
|
|
30
|
+
"MT": "15871",
|
|
31
|
+
"MS": "15872",
|
|
32
|
+
"MG": "15873",
|
|
33
|
+
"PA": "15874",
|
|
34
|
+
"PB": "15875",
|
|
35
|
+
"PR": "15876",
|
|
36
|
+
"PE": "15877",
|
|
37
|
+
"PI": "15878",
|
|
38
|
+
"RJ": "15879",
|
|
39
|
+
"RN": "15880",
|
|
40
|
+
"RS": "15881",
|
|
41
|
+
"RO": "15882",
|
|
42
|
+
"RR": "15883",
|
|
43
|
+
"SC": "15884",
|
|
44
|
+
"SP": "15885",
|
|
45
|
+
"SE": "15886",
|
|
46
|
+
"TO": "15887",
|
|
47
|
+
}
|
|
48
|
+
NON_PERFORMING_LOANS_BY_REGION_PJ = {
|
|
49
|
+
"N": "15920",
|
|
50
|
+
"NE": "15921",
|
|
51
|
+
"CO": "15922",
|
|
52
|
+
"SE": "15923",
|
|
53
|
+
"S": "15924",
|
|
54
|
+
}
|
|
55
|
+
NON_PERFORMING_LOANS_BY_STATE_PJ = {
|
|
56
|
+
"AC": "15893",
|
|
57
|
+
"AL": "15894",
|
|
58
|
+
"AP": "15895",
|
|
59
|
+
"AM": "15896",
|
|
60
|
+
"BA": "15897",
|
|
61
|
+
"CE": "15898",
|
|
62
|
+
"DF": "15899",
|
|
63
|
+
"ES": "15900",
|
|
64
|
+
"GO": "15901",
|
|
65
|
+
"MA": "15902",
|
|
66
|
+
"MT": "15903",
|
|
67
|
+
"MS": "15904",
|
|
68
|
+
"MG": "15905",
|
|
69
|
+
"PA": "15906",
|
|
70
|
+
"PB": "15907",
|
|
71
|
+
"PR": "15908",
|
|
72
|
+
"PE": "15909",
|
|
73
|
+
"PI": "15910",
|
|
74
|
+
"RJ": "15911",
|
|
75
|
+
"RN": "15912",
|
|
76
|
+
"RS": "15913",
|
|
77
|
+
"RO": "15914",
|
|
78
|
+
"RR": "15915",
|
|
79
|
+
"SC": "15916",
|
|
80
|
+
"SP": "15917",
|
|
81
|
+
"SE": "15918",
|
|
82
|
+
"TO": "15919",
|
|
83
|
+
}
|
|
84
|
+
NON_PERFORMING_LOANS_BY_REGION_TOTAL = {
|
|
85
|
+
"N": "15952",
|
|
86
|
+
"NE": "15953",
|
|
87
|
+
"CO": "15954",
|
|
88
|
+
"SE": "15955",
|
|
89
|
+
"S": "15956",
|
|
90
|
+
}
|
|
91
|
+
NON_PERFORMING_LOANS_BY_STATE_TOTAL = {
|
|
92
|
+
"AC": "15925",
|
|
93
|
+
"AL": "15926",
|
|
94
|
+
"AP": "15927",
|
|
95
|
+
"AM": "15928",
|
|
96
|
+
"BA": "15929",
|
|
97
|
+
"CE": "15930",
|
|
98
|
+
"DF": "15931",
|
|
99
|
+
"ES": "15932",
|
|
100
|
+
"GO": "15933",
|
|
101
|
+
"MA": "15934",
|
|
102
|
+
"MT": "15935",
|
|
103
|
+
"MS": "15936",
|
|
104
|
+
"MG": "15937",
|
|
105
|
+
"PA": "15938",
|
|
106
|
+
"PB": "15939",
|
|
107
|
+
"PR": "15940",
|
|
108
|
+
"PE": "15941",
|
|
109
|
+
"PI": "15942",
|
|
110
|
+
"RJ": "15943",
|
|
111
|
+
"RN": "15944",
|
|
112
|
+
"RS": "15945",
|
|
113
|
+
"RO": "15946",
|
|
114
|
+
"RR": "15947",
|
|
115
|
+
"SC": "15948",
|
|
116
|
+
"SP": "15949",
|
|
117
|
+
"SE": "15950",
|
|
118
|
+
"TO": "15951",
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def get_non_performing_loans_codes(states_or_region, mode="total"):
|
|
123
|
+
is_state = False
|
|
124
|
+
is_region = False
|
|
125
|
+
states_or_region = [states_or_region] if isinstance(states_or_region, str) else states_or_region
|
|
126
|
+
states_or_region = [location.upper() for location in states_or_region]
|
|
127
|
+
if any(location in list(NON_PERFORMING_LOANS_BY_STATE_TOTAL.keys()) for location in states_or_region):
|
|
128
|
+
is_state = True
|
|
129
|
+
elif any(location in list(NON_PERFORMING_LOANS_BY_REGION_TOTAL.keys()) for location in states_or_region):
|
|
130
|
+
is_region = True
|
|
131
|
+
|
|
132
|
+
if not is_state and not is_region:
|
|
133
|
+
raise Exception(f"Not a valid state or region: {states_or_region}")
|
|
134
|
+
|
|
135
|
+
codes = {}
|
|
136
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_STATE_TOTAL
|
|
137
|
+
if is_state:
|
|
138
|
+
if mode.upper() == "PF":
|
|
139
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_STATE_PF
|
|
140
|
+
elif mode.upper() == "PJ":
|
|
141
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_STATE_PJ
|
|
142
|
+
elif is_region:
|
|
143
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_REGION_TOTAL
|
|
144
|
+
if mode.upper() == "PF":
|
|
145
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_REGION_PF
|
|
146
|
+
elif mode.upper() == "PJ":
|
|
147
|
+
non_performing_loans_by_location = NON_PERFORMING_LOANS_BY_REGION_PJ
|
|
148
|
+
|
|
149
|
+
for location in states_or_region:
|
|
150
|
+
codes[location] = non_performing_loans_by_location[location]
|
|
151
|
+
return codes
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def get_non_performing_loans(states_or_region, mode="total", start=None, end=None, last=0, freq=None):
|
|
155
|
+
"""Dados de inadimplência das operações de crédito.
|
|
156
|
+
|
|
157
|
+
Esta função é um *wrapper* para o método para a função ``get`` do módulo ``sgs``,
|
|
158
|
+
simplificando o acesso aos dados de inadimplência das operações de crédito.
|
|
159
|
+
Nessa função o usuário escolhe o tipo de inadimplência, o(s) estado(s) ou as regiões
|
|
160
|
+
que deseja obter os dados.
|
|
161
|
+
|
|
162
|
+
>>> from bcb.sgs.regional_economy import get_non_performing_loans
|
|
163
|
+
>>> from bcb.utils import BRAZILIAN_REGIONS
|
|
164
|
+
>>> series = get_non_performing_loans(["RR"], last=10, mode="all")
|
|
165
|
+
>>> northeast_states = BRAZILIAN_REGIONS["NE"]
|
|
166
|
+
>>> series_ne = get_non_performing_loans(northeast_states, last=5, mode="pj")
|
|
167
|
+
|
|
168
|
+
Parameters
|
|
169
|
+
----------
|
|
170
|
+
|
|
171
|
+
states_or_region (List[str]): Uma lista com estado ou região.
|
|
172
|
+
mode (str): O tipo de inadimplência. Pode ser "PF" (pessoas físicas),
|
|
173
|
+
"PJ" (pessoas jurídicas) ou "total" (inadimplência total).
|
|
174
|
+
start : str, int, date, datetime, Timestamp
|
|
175
|
+
Data de início da série.
|
|
176
|
+
Interpreta diferentes tipos e formatos de datas.
|
|
177
|
+
end : string, int, date, datetime, Timestamp
|
|
178
|
+
Data final da série.
|
|
179
|
+
Interpreta diferentes tipos e formatos de datas.
|
|
180
|
+
last : int
|
|
181
|
+
Retorna os últimos ``last`` elementos disponíveis da série temporal
|
|
182
|
+
solicitada. Se ``last`` for maior que 0 (zero) os argumentos ``start``
|
|
183
|
+
e ``end`` são ignorados.
|
|
184
|
+
freq : str
|
|
185
|
+
Define a frequência a ser utilizada na série temporal
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
|
|
191
|
+
``DataFrame`` :
|
|
192
|
+
série temporal univariada ou multivariada,
|
|
193
|
+
quando solicitado mais de uma série temporal.
|
|
194
|
+
"""
|
|
195
|
+
codes = get_non_performing_loans_codes(states_or_region, mode=mode)
|
|
196
|
+
return get(codes, start=start, end=end, last=last, multi=True, freq=freq)
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
from datetime import datetime, date
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
BRAZILIAN_REGIONS = {
|
|
5
|
+
"N": ["AC", "AP", "AM", "PA", "RO", "RR", "TO"],
|
|
6
|
+
"NE": ["AL", "BA", "CE", "MA", "PB", "PE", "PI", "RN", "SE"],
|
|
7
|
+
"CO": ["DF", "GO", "MT", "MS"],
|
|
8
|
+
"SE": ["ES", "MG", "RJ", "SP"],
|
|
9
|
+
"S": ["PR", "RS", "SC"]
|
|
10
|
+
}
|
|
11
|
+
BRAZILIAN_STATES = []
|
|
12
|
+
for state in BRAZILIAN_REGIONS.values():
|
|
13
|
+
BRAZILIAN_STATES.extend(state)
|
|
14
|
+
|
|
15
|
+
|
|
4
16
|
class Date:
|
|
5
17
|
def __init__(self, d=None, format="%Y-%m-%d", mindate=date(1900, 1, 1)):
|
|
6
18
|
d = d if d else mindate
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-bcb"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["wilsonfreitas <wilson.freitas@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -18,16 +18,19 @@ pytest = ">= 7.1.3"
|
|
|
18
18
|
flaky = ">= 3.7.0"
|
|
19
19
|
|
|
20
20
|
[tool.poetry.group.docs.dependencies]
|
|
21
|
-
Sphinx = "
|
|
22
|
-
pydata-sphinx-theme = "
|
|
21
|
+
Sphinx = "^6"
|
|
22
|
+
pydata-sphinx-theme = "^0.16"
|
|
23
23
|
matplotlib = ">= 3.5.3"
|
|
24
24
|
ipython = ">= 8.14.0"
|
|
25
|
-
furo = "
|
|
25
|
+
furo = "^2024"
|
|
26
|
+
pickleshare = "^0.7.5"
|
|
27
|
+
pygments = "^2.7"
|
|
26
28
|
|
|
27
29
|
[tool.poetry.group.dev.dependencies]
|
|
28
30
|
pycodestyle = ">= 2.9.1"
|
|
29
31
|
ipykernel = ">= 6.15.2"
|
|
30
32
|
black = {version = ">= 22.8.0", allow-prereleases = true}
|
|
33
|
+
jupyter = "^1.1.1"
|
|
31
34
|
|
|
32
35
|
[build-system]
|
|
33
36
|
requires = ["poetry-core"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|