How to use the quandl.model.data.Data.page 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_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_data.py View on Github external
def test_pandas_dataframe_date_field_is_datetime(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['per_end_date'][0], pandas.datetime)
        self.assertIsInstance(df['per_end_date'][1], pandas.datetime)
        self.assertIsInstance(df['per_end_date'][2], pandas.datetime)
        self.assertIsInstance(df['per_end_date'][3], pandas.datetime)
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_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_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_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_data_calls_connection_post(self, mock):
        RequestType.USE_GET_REQUEST = False
        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('post', 'datatables/ZACKS/FC',
                        json={'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_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 / quandl / model / datatable.py View on Github external
def data(self, **options):
        if not options:
            options = {'params': {}}
        return Data.page(self, **options)