twelvedata/twelvedata-python

[Feature Request/Bug] as_pandas() for quote endpoint

Closed this issue · 1 comments

It is not clear from the documentation if as_pandas() is supported for other core endpoints than time_series since the use case is the same, and nothing regarding supported datatypes are mentioned. It would be nice to have quotes supporting as_pandas().

When calling as_pandas() on a QuoteEndpoint object, I get the following error:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/twelvedata/utils.py", line 147, in convert_collection_to_pandas
    return pandas.DataFrame.from_dict(val, orient="index", dtype="float")
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/pandas/core/frame.py", line 1677, in from_dict
    return cls(data, index=index, columns=columns, dtype=dtype)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/pandas/core/frame.py", line 737, in __init__
    mgr = ndarray_to_mgr(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/pandas/core/internals/construction.py", line 340, in ndarray_to_mgr
    values = sanitize_array(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/pandas/core/construction.py", line 567, in sanitize_array
    subarr = _try_cast(data, dtype, copy, raise_cast_failure)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/api/lib/python3.9/site-packages/pandas/core/construction.py", line 781, in _try_cast
    subarr = np.array(arr, dtype=dtype, copy=copy)
ValueError: could not convert string to float: 'AAPL'