Skip to content

Commit

Permalink
add support for 'code' column in datatables (quandl#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeiQ authored Mar 7, 2017
1 parent f03b21f commit 1d06fe5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
/quandl.egg-info
/build
/dist
/tmp/
/tmp/
.idea/*
venv
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 3.1.0 - 2017-03-07

* Bug: support column with a name 'code'


### 3.0.1 - 2016-05-25

* Handle unexpected errors
Expand Down
4 changes: 2 additions & 2 deletions quandl/get_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os


def get_table(code, **options):
def get_table(datatable_code, **options):
if 'paginate' in options.keys():
paginate = options.pop('paginate')
else:
Expand All @@ -16,7 +16,7 @@ def get_table(code, **options):
page_count = 0
while True:
next_options = copy.deepcopy(options)
next_data = Datatable(code).data(params=next_options)
next_data = Datatable(datatable_code).data(params=next_options)

if data is None:
data = next_data
Expand Down
2 changes: 1 addition & 1 deletion quandl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '3.0.1'
VERSION = '3.1.0'
2 changes: 1 addition & 1 deletion test/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ def test_build_request(self, mock):
'accept': ('application/json, '
'application/vnd.quandl+json;version=2015-04-09'),
'request-source': 'python',
'request-source-version': '3.0.1'},
'request-source-version': '3.1.0'},
params={'per_page': 10, 'page': 2})
self.assertEqual(mock.call_args, expected)
5 changes: 5 additions & 0 deletions test/test_get_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ def tearDownClass(cls):
def test_datatable_returns_datatable_object(self, mock):
df = quandl.get_table('ZACKS/FC', params={})
self.assertIsInstance(df, pandas.core.frame.DataFrame)

@patch('quandl.connection.Connection.request')
def test_datatable_with_code_returns_datatable_object(self, mock):
df = quandl.get_table('AR/MWCF', code="ICEP_WAC_Z2017_S")
self.assertIsInstance(df, pandas.core.frame.DataFrame)

0 comments on commit 1d06fe5

Please sign in to comment.