Skip to content

Commit dcb05e7

Browse files
authored
Merge pull request #2 from VapingDoge/econ-fix
Econ fix
2 parents 4c10022 + c4d5848 commit dcb05e7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

pandas_datareader/econdb.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ def show_func(x):
9090
def show_func(x):
9191
return x[: x.find(":")]
9292

93+
unique_keys = {k for s in results for k in s["additional_metadata"]}
9394
for entry in results:
9495
series = pd.DataFrame(entry["data"])[["dates", "values"]].set_index("dates")
9596
head = entry["additional_metadata"]
96-
97+
for k in unique_keys:
98+
if k not in head:
99+
head[k] = "-1:None"
97100
if head != "": # this additional metadata is not blank
98101
series.columns = pd.MultiIndex.from_tuples(
99102
[[show_func(x) for x in head.values()]],

pandas_datareader/tests/test_econdb.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ def assert_equal(x, y):
1212

1313

1414
class TestEcondb(object):
15+
16+
def test_override_start_end(self):
17+
df = web.DataReader(
18+
'&'.join([
19+
'dataset=RBI_BULLETIN',
20+
'v=TIME',
21+
'h=Indicator',
22+
'from=2022-01-01',
23+
'to=2022-07-01'
24+
]),
25+
'econdb',
26+
start='2020-01-01',
27+
end='2022-01-01'
28+
)
29+
assert isinstance(df.index, pd.DatetimeIndex)
30+
1531
def test_infer_start_end_from_symbols(self):
1632
df = web.DataReader(
1733
(

0 commit comments

Comments
 (0)