energyquantified / eq-python-client

Python library for Energy Quantified's Time Series API.
https://energyquantified-python.readthedocs.io/
Apache License 2.0
15 stars 1 forks source link

SDK complains about missing pandas dependency but pandas is present #67

Closed komape closed 1 year ago

komape commented 1 year ago

I have the following script in a Jupyter notebook.

from energyquantified import EnergyQuantified
import pandas as pd

eq = EnergyQuantified(api_key='aaaa-bbbb-cccc-dddd')

de_load = eq.timeseries.load('DE Residual Load MWh/h 15min Actual', begin='2020-01-01', end='2021-01-01', frequency='PT1H')

pd.DataFrame(de_load)

de_load_df = de_load.to_df()

The last line throws the following error:

ImportError: You must install the "pandas" data analysis library to use this functionality. Visit https://pandas.pydata.org/docs/ for more information.

If I remove the last line, no error occurs and I receive from the second-last line a valid panda DataFrame.

My IDE:

DataSpell 2023.1 Build #DS-231.8109.197, built on March 29, 2023 Runtime version: 17.0.6+10-b829.5 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.2.1 GC: G1 Young Generation, G1 Old Generation Memory: 1504M Cores: 8 Metal Rendering is ON Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true python.scientific.always_use_sci_view=true python.scientific.show_help_window=false

DataSpell is running Python 3.9 and Jupyter Notebook 6.5.4.

jonmd commented 1 year ago

@komape Are you sure there is not something awkward with your setup? The client tries to import pandas and sets a flag when the import fails.

See https://github.com/energyquantified/eq-python-client/blob/master/energyquantified/utils/pandas.py#L57

komape commented 1 year ago

I know. It's just my observation. I definitely have pandas and can create data frames. But calling to_df() raises the mentioned error.

If I can receive the error, a customer can do so too. That is why I think we should fix that. For the customer's satisfaction.

komape commented 1 year ago

Some more context. I think, the issue was that I used the autogenerated virtual environment from DataSpell. I now switched to my system python and the error is not showing up.

jonmd commented 1 year ago

It seems like it was a Python configuration problem, so I am closing this issue.