Skip to content

Commit

Permalink
Update Docs and DataReader Wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Aug 5, 2017
1 parent 8ee6e89 commit f79ef9f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
7 changes: 5 additions & 2 deletions docs/source/remote_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,18 @@ Available expiry dates can be accessed from the ``expiry_dates`` property.
Enigma
======

Access datasets from `Enigma <https://app.enigma.io>`__,
Access datasets from `Enigma <https://public.enigma.com>`__,
the world's largest repository of structured public data.

Datasets are unique identified by the ``uuid4`` at the end of a dataset's web address.
For example, the following code downloads USDA Food Recall Data from https://public.enigma.com/datasets/292129b0-1275-44c8-a6a3-2a0881f24fe1.

.. ipython:: python
import os
import pandas_datareader as pdr
df = pdr.get_data_enigma('enigma.trade.ams.toxic.2015', os.getenv('ENIGMA_API_KEY'))
df = pdr.get_data_enigma('292129b0-1275-44c8-a6a3-2a0881f24fe1', os.getenv('ENIGMA_API_KEY'))
df.columns
.. _remote_data.quandl:
Expand Down
2 changes: 1 addition & 1 deletion pandas_datareader/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def DataReader(name, data_source=None, start=None, end=None,
session=session).read()

elif data_source == "enigma":
return EnigmaReader(datapath=name, api_key=access_key).read()
return EnigmaReader(dataset_id=name, api_key=access_key).read()

elif data_source == "fred":
return FredReader(symbols=name, start=start, end=end,
Expand Down
5 changes: 2 additions & 3 deletions pandas_datareader/enigma.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ def __init__(self,

self._dataset_id = dataset_id
if not isinstance(self._dataset_id, compat.string_types):
# TODO: test if string is valid UUID
raise ValueError(
"The Enigma dataset_id must be a UUID4 string (ex: "
"The Enigma dataset_id must be a string (ex: "
"'bedaf052-5fcd-4758-8d27-048ce8746c6a')")

headers = {
Expand Down Expand Up @@ -106,7 +105,7 @@ def get_current_snapshot_id(self, dataset_id):

def get_dataset_metadata(self, dataset_id):
"""Get the Dataset Model of this EnigmaReader's dataset
<Add Link to Model Docs>
https://docs.public.enigma.com/resources/dataset/index.html
"""
url = "datasets/{0}?row_limit=0".format(dataset_id)
response = self._get(url)
Expand Down
4 changes: 2 additions & 2 deletions pandas_datareader/tests/test_enigma.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class TestEnigma(object):

@property
def dataset_id():
def dataset_id(self):
"""
USDA Food Recall Archive
USDA Food Recall Archive - 1996
Selected for being a relatively small dataset.
https://public.enigma.com/datasets/292129b0-1275-44c8-a6a3-2a0881f24fe1
"""
Expand Down

0 comments on commit f79ef9f

Please sign in to comment.