AnBowell/whittaker-eilers

python: ImportError: cannot import name 'Whittaker' from 'whittaker_eilers'

Closed this issue · 3 comments

Hi,

I am trying to use this package. The error I am getting is as follows.
Traceback (most recent call last):
File "/home/pranav/epat/stockbot/regression_strategy_test.py", line 9, in
from whittaker_eilers import Whittaker
ImportError: cannot import name 'Whittaker' from 'whittaker_eilers' (/home/pranav/.virtualenvs/regressiontest/lib/python3.11/site-packages/whittaker_eilers/init.py)

My code is below.

from whittaker_eilers import Whittaker
whittaker_smoother = WhittakerSmoother(lmbda=20,order=2,data_length=len(df["close"]))
	smoothed_prices = whittaker_smoother.smooth(df["close"])


```What am I doing wrong?

Hey there,

You'll need to import WhittakerSmoother instead of Whittaker and it should work for you. I'd definitely recommend getting some form of autocomplete set up in your IDE!

Hi Andrew,

Many thanks. I did have to write from whittaker_eilers import WhittakerSmoother I am using visual studio code which does indeed have auto complete but I cannot tell why it did not trigger in this case. Thanks again for your answer.

Hmm, good to know. Someone else did mention this being an issue but in Jupyter Notebook. I have since released a new version which I thought fixed this, so let me know if you continue to have issues with it!