Skip to content

Attempting to retrieve more that 1 year of data using a free API key results in a Pandas error rather than useful warning message #66

@pjmcdermott

Description

@pjmcdermott

Novice user of eodhd API, so please forgive my inexperience.

Trying to get more than 1 year of data using a free API key results in a Pandas error:

(Pdb) prices = api.get_historical_data("BUKAC.INDX", interval="d", iso8601_start=from_date, results=10000)
*** ValueError: Length mismatch: Expected axis has 9 elements, new values have 8 elements

The issue appears to be in apiclient.py, around line 326 when the columns are given new labels.

The df_data Pandas DataFrame in the response appears to have an additional 'warnings' column, hence then error message when changing column names:

(Pdb) df_data
                     open           high            low          close  ...  volume                                            warning      symbol interval
date                                                                    ...                                                                                
2025-04-22 14347.88960000 14414.09960000 14293.03030000 14404.04980000  ...       0                                                NaN  BUKAC.INDX        d
2025-04-23 14404.04980000 14645.25980000 14403.54980000 14549.41990000  ...       0                                                NaN  BUKAC.INDX        d
2025-04-24 14549.41990000 14569.17970000 14476.80960000 14566.61040000  ...       0                                                NaN  BUKAC.INDX        d
2025-04-25 14566.61040000 14621.66990000 14549.66990000 14577.83980000  ...       0                                                NaN  BUKAC.INDX        d
2025-04-28 14577.83980000 14658.75980000 14577.80960000 14606.96000000  ...       0                                                NaN  BUKAC.INDX        d
...                   ...            ...            ...            ...  ...     ...                                                ...         ...      ...
2026-04-13 18223.13090000 18232.91990000 18109.60940000 18194.53910000  ...       0                                                NaN  BUKAC.INDX        d
2026-04-14 18194.53910000 18297.33980000 18186.69920000 18262.16020000  ...       0                                                NaN  BUKAC.INDX        d
2026-04-15 18262.16020000 18315.91990000 18204.76950000 18210.57030000  ...       0                                                NaN  BUKAC.INDX        d
2026-04-16 18210.57030000 18336.69920000 18189.75000000 18232.25000000  ...       0                                                NaN  BUKAC.INDX        d
2026-04-17 18232.25000000 18380.63090000 18162.27930000 18373.51950000  ...       0  Data is limited by one year as you have free s...  BUKAC.INDX        d

[254 rows x 9 columns]
(Pdb) 

It would be better to simply exit with the the warning message from the final line of the 'warnings' column at this point (or directly when data > 1 year old is requested), rather than triggering a difficult to understand Pandas error.

As an aside, it appears to me at first glance the re-labelling the columns is redundant as the columns already have the correct names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions