Skip to content

Commit 7c030f0

Browse files
econdb - update start/end handling
use the symbols string for start and end dates when available
1 parent 90f155a commit 7c030f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas_datareader/econdb.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@ def url(self):
2222

2323
def read(self):
2424
""" read one data from specified URL """
25+
params = dict(s.split('=') for s in self.symbols.split('&'))
26+
if 'from' in params:
27+
self.start = pd.to_datetime(params['from'], format='%Y-%m-%d')
28+
if 'to' in params:
29+
self.end = pd.to_datetime(params['to'], format='%Y-%m-%d')
30+
2531
results = self.session.get(self.url).json()["results"]
2632
df = pd.DataFrame({"dates": []}).set_index("dates")
2733

2834
if self._show == "labels":
2935

3036
def show_func(x):
31-
return x[x.find(":") + 1 :]
37+
return x[x.find(":") + 1:]
3238

3339
elif self._show == "codes":
3440

0 commit comments

Comments
 (0)