Skip to content

Commit b5e6346

Browse files
authored
Merge pull request #796 from bashtage/econdb-master
Econdb master
2 parents 6bea25c + 3065237 commit b5e6346

File tree

18 files changed

+108
-42
lines changed

18 files changed

+108
-42
lines changed

.travis.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,32 @@ env:
1010
matrix:
1111
fast_finish: true
1212
include:
13-
- python: 3.5
14-
env: PANDAS=0.21 NUMPY=1.13
15-
- python: 3.5
16-
env: PANDAS=0.22 NUMPY=1.13
1713
- python: 3.6
18-
env: PANDAS=0.23 NUMPY=1.14
14+
env: PANDAS=0.23 NUMPY=1.16
1915
- python: 3.7
2016
env: PANDAS=0.25 NUMPY=1.17 DOCBUILD=true
2117
- python: 3.7
22-
env: PANDAS=0.25 NUMPY=1.17
23-
- python: 3.7
24-
env: TEST_TYPE="quandl" PANDAS=0.25 NUMPY=1.17
25-
- python: 3.8
2618
env: PANDAS=0.25 NUMPY=1.18
19+
- python: 3.8
20+
env: PANDAS=1 NUMPY=1.18
21+
- python: 3.8
22+
env: PANDAS=1 NUMPY=1.19
23+
- python: 3.7
24+
env: TEST_TYPE="quandl" PANDAS=1 NUMPY=1.19
2725
# In allow failures
2826
- python: 3.7
29-
env: TEST_TYPE="alpha_vantage" PANDAS=0.25 NUMPY=1.17
27+
env: TEST_TYPE="alpha_vantage" PANDAS=1 NUMPY=1.19
3028
- python: 3.7
31-
env: TEST_TYPE="not stable and not alpha_vantage and not quandl" PANDAS=0.25 NUMPY=1.17
29+
env: TEST_TYPE="not stable and not alpha_vantage and not quandl" PANDAS=1 NUMPY=1.19
3230
- python: 3.7
33-
env: PANDAS="MASTER" NUMPY=1.17
31+
env: PANDAS="MASTER" NUMPY=1.18
3432
allow_failures:
3533
- python: 3.7
3634
env: PANDAS="MASTER" NUMPY=1.17
3735
- python: 3.7
38-
env: TEST_TYPE="alpha_vantage" PANDAS=0.25 NUMPY=1.17
36+
env: TEST_TYPE="alpha_vantage" PANDAS=1 NUMPY=1.19
3937
- python: 3.7
40-
env: TEST_TYPE="not stable and not alpha_vantage and not quandl" PANDAS=0.25 NUMPY=1.17
38+
env: TEST_TYPE="not stable and not alpha_vantage and not quandl" PANDAS=1 NUMPY=1.19
4139

4240
install:
4341
- source ci/pypi-install.sh;

docs/source/conf.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16-
import sys
1716
import os
17+
import sys
18+
19+
# Add any Sphinx extension module names here, as strings. They can be
20+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
21+
# ones.
22+
import IPython
23+
1824
import pandas_datareader as pdr
1925
import sphinx_rtd_theme
2026

@@ -33,10 +39,6 @@
3339
#
3440
# needs_sphinx = '1.0'
3541

36-
# Add any Sphinx extension module names here, as strings. They can be
37-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38-
# ones.
39-
import IPython
4042

4143
extensions = [
4244
"sphinx.ext.autodoc",

pandas_datareader/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import datetime
22
import time
3+
from urllib.parse import urlencode
34
import warnings
45

56
import numpy as np
67
from pandas import DataFrame, concat, read_csv
7-
from urllib.parse import urlencode
88
import requests
99

1010
from pandas_datareader._utils import (

pandas_datareader/compat/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
PANDAS_0220 = PANDAS_VERSION >= LooseVersion("0.22.0")
1515
PANDAS_0230 = PANDAS_VERSION >= LooseVersion("0.23.0")
1616

17-
1817
__all__ = [
1918
"HTTPError",
2019
"StringIO",

pandas_datareader/data.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,36 @@
1616
from pandas_datareader.econdb import EcondbReader
1717
from pandas_datareader.enigma import EnigmaReader
1818
from pandas_datareader.eurostat import EurostatReader
19-
from pandas_datareader.exceptions import DEP_ERROR_MSG, ImmediateDeprecationError
19+
from pandas_datareader.exceptions import (
20+
DEP_ERROR_MSG,
21+
ImmediateDeprecationError,
22+
)
2023
from pandas_datareader.famafrench import FamaFrenchReader
2124
from pandas_datareader.fred import FredReader
2225
from pandas_datareader.iex.daily import IEXDailyReader
2326
from pandas_datareader.iex.deep import Deep as IEXDeep
24-
from pandas_datareader.iex.tops import LastReader as IEXLasts, TopsReader as IEXTops
27+
from pandas_datareader.iex.tops import (
28+
LastReader as IEXLasts,
29+
TopsReader as IEXTops,
30+
)
2531
from pandas_datareader.moex import MoexReader
2632
from pandas_datareader.nasdaq_trader import get_nasdaq_symbols
2733
from pandas_datareader.oecd import OECDReader
2834
from pandas_datareader.quandl import QuandlReader
29-
from pandas_datareader.robinhood import RobinhoodHistoricalReader, RobinhoodQuoteReader
35+
from pandas_datareader.robinhood import (
36+
RobinhoodHistoricalReader,
37+
RobinhoodQuoteReader,
38+
)
3039
from pandas_datareader.stooq import StooqDailyReader
3140
from pandas_datareader.tiingo import (
3241
TiingoDailyReader,
3342
TiingoIEXHistoricalReader,
3443
TiingoQuoteReader,
3544
)
3645
from pandas_datareader.yahoo.actions import YahooActionReader, YahooDivReader
37-
from pandas_datareader.yahoo.components import _get_data as get_components_yahoo
46+
from pandas_datareader.yahoo.components import (
47+
_get_data as get_components_yahoo,
48+
)
3849
from pandas_datareader.yahoo.daily import YahooDailyReader
3950
from pandas_datareader.yahoo.options import Options as YahooOptions
4051
from pandas_datareader.yahoo.quotes import YahooQuotesReader

pandas_datareader/econdb.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pandas as pd
2+
23
from pandas_datareader.base import _BaseReader
34

45

@@ -27,25 +28,27 @@ def read(self):
2728
if self._show == "labels":
2829

2930
def show_func(x):
30-
return x.split(":")[1]
31+
return x[x.find(":") + 1 :]
3132

3233
elif self._show == "codes":
3334

3435
def show_func(x):
35-
return x.split(":")[0]
36+
return x[: x.find(":")]
3637

3738
for entry in results:
3839
series = pd.DataFrame(entry["data"])[["dates", "values"]].set_index("dates")
39-
4040
head = entry["additional_metadata"]
41+
4142
if head != "": # this additional metadata is not blank
4243
series.columns = pd.MultiIndex.from_tuples(
4344
[[show_func(x) for x in head.values()]],
4445
names=[show_func(x) for x in head.keys()],
4546
)
47+
else:
48+
series.rename(columns={"values": entry["ticker"]}, inplace=True)
4649

4750
if not df.empty:
48-
df = df.join(series, how="outer")
51+
df = df.merge(series, how="outer", left_index=True, right_index=True)
4952
else:
5053
df = series
5154
if df.shape[0] > 0:

pandas_datareader/iex/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
2+
from urllib.parse import urlencode
23

34
import pandas as pd
4-
from urllib.parse import urlencode
55

66
from pandas_datareader.base import _BaseReader
77

pandas_datareader/moex.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
import pandas as pd
44

55
from pandas_datareader.base import _DailyBaseReader
6-
from pandas_datareader.compat import StringIO, binary_type, concat, is_list_like
6+
from pandas_datareader.compat import (
7+
StringIO,
8+
binary_type,
9+
concat,
10+
is_list_like,
11+
)
712

813

914
class MoexReader(_DailyBaseReader):

pandas_datareader/robinhood.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import pandas as pd
22

33
from pandas_datareader.base import _BaseReader
4-
from pandas_datareader.exceptions import DEP_ERROR_MSG, ImmediateDeprecationError
4+
from pandas_datareader.exceptions import (
5+
DEP_ERROR_MSG,
6+
ImmediateDeprecationError,
7+
)
58

69

710
class RobinhoodQuoteReader(_BaseReader):

pandas_datareader/tests/test_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import datetime as dt
2+
23
import pytest
34
import requests
45

0 commit comments

Comments
 (0)