How to use the quandl.model.datatable.Datatable function in Quandl

To help you get started, we’ve selected a few Quandl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_to_numpy_returns_numpy_object(self, request_method):
        if request_method == 'POST':
            RequestType.USE_GET_REQUEST = False
        datatable = Datatable('ZACKS/FC')
        results = Data.page(datatable, params={})
        data = results.to_numpy()
        self.assertIsInstance(data, numpy.core.records.recarray)
github quandl / quandl-python / test / test_datatable.py View on Github external
def test_datatable_data_calls_connection_with_no_params_for_post_request(self, mock):
        RequestType.USE_GET_REQUEST = False
        Datatable('ZACKS/FC').data()
        expected = call('post', 'datatables/ZACKS/FC', json={})
        self.assertEqual(mock.call_args, expected)
github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_to_pandas_returns_pandas_dataframe_object(self, request_method):
        if request_method == 'POST':
            RequestType.USE_GET_REQUEST = False
        datatable = Datatable('ZACKS/FC')
        results = Data.page(datatable, params={})
        df = results.to_pandas()
        self.assertIsInstance(df, pandas.core.frame.DataFrame)
github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_pandas_dataframe_index_is_none(self, request_method):
        if request_method == 'POST':
            RequestType.USE_GET_REQUEST = False
        datatable = Datatable('ZACKS/FC')
        results = Data.page(datatable, params={})
        df = results.to_pandas()
        self.assertEqual(df.index.name, 'None')
github quandl / quandl-python / test / test_datatable.py View on Github external
def test_datatable_metadata_calls_connection(self, mock):
        Datatable('ZACKS/FC').data_fields()
        expected = call('get', 'datatables/ZACKS/FC/metadata', params={})
        self.assertEqual(mock.call_args, expected)
github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_values_and_meta_exist(self, request_method):
        if request_method == 'POST':
            RequestType.USE_GET_REQUEST = False
        datatable = Datatable('ZACKS/FC')
        results = Data.page(datatable, params={})
        self.assertIsNotNone(results.values)
        self.assertIsNotNone(results.meta)
github quandl / quandl-python / test / test_datatable.py View on Github external
RequestType.USE_GET_REQUEST = False
        params = {'ticker': ['AAPL', 'MSFT'],
                  'per_end_date': {'gte': '2015-01-01'},
                  'qopts': {'columns': ['ticker', 'per_end_date']},
                  'foo': 'bar',
                  'baz': 4
                  }

        expected_params = {'ticker': ['AAPL', 'MSFT'],
                           'per_end_date.gte': '2015-01-01',
                           'qopts.columns': ['ticker', 'per_end_date'],
                           'foo': 'bar',
                           'baz': 4
                           }

        Datatable('ZACKS/FC').data(params=params)
        expected = call('post', 'datatables/ZACKS/FC', json=expected_params)
        self.assertEqual(mock.call_args, expected)
github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_to_csv_returns_expected_csv(self, request_method):
        if request_method == 'POST':
            RequestType.USE_GET_REQUEST = False
        datatable = Datatable('ZACKS/FC')
        results = Data.page(datatable, params={})
        data = results.to_csv()
        expected = "None,per_end_date,ticker,tot_oper_exp\n" + \
                   "0,2015-07-11,AAPL,456.9\n" + \
                   "1,2015-07-13,433.3,\n" + \
                   "2,2015-07-14,AAPL,419.1\n" + \
                   "3,2015-07-15,476.5,\n"
        self.assertEqual(data, expected)
github quandl / quandl-python / test / test_datatable_data.py View on Github external
def test_data_calls_connection_get(self, mock):
        datatable = Datatable('ZACKS/FC')
        Data.page(datatable, params={'ticker': ['AAPL', 'MSFT'],
                                     'per_end_date': {'gte': '2015-01-01'},
                                     'qopts': {'columns': ['ticker', 'per_end_date']}})
        expected = call('get', 'datatables/ZACKS/FC',
                        params={'ticker[]': ['AAPL', 'MSFT'],
                                'per_end_date.gte': '2015-01-01',
                                'qopts.columns[]': ['ticker', 'per_end_date']})
        self.assertEqual(mock.call_args, expected)
github quandl / quandl-python / test / test_datatable.py View on Github external
def test_datatable_returns_datatable_object(self):
        datatable = Datatable('ZACKS/FC')
        self.assertIsInstance(datatable, Datatable)
        self.assertEqual(datatable.vendor_code, 'ZACKS')
        self.assertEqual(datatable.datatable_code, 'FC')