pandas-ta icon indicating copy to clipboard operation
pandas-ta copied to clipboard

Yearly pivots causes error with pandas 2.x

Open derenderen opened this issue 2 years ago • 2 comments

Which version are you running? The lastest version is on Github. Pip is for major releases. 0.4.4b0 pandas version: pandas 2.0.3 Do you have TA Lib also installed in your environment? NO.

Have you tried the development version? Did it resolve the issue? Using development version. Describe the bug Whenever i try to create yearly pivot points i receive error:

ValueError: Units 'M', 'Y', and 'y' are no longer supported, as they do not represent unambiguous timedelta values durations.

500 days of stock data.

pivots = ta.pivots(df['Open'],df['High'],df['Low'],df['Close'],anchor='Y',method='fibonacci')

Setting 'Y' for anchor returns error. It says 'M' is also depreciated. However it works fine if i set 'M' for anchor value.

derenderen avatar Oct 15 '23 08:10 derenderen

Hello @derenderen,

Pandas TA is still being developed with Pandas v1.4+ to support many others using older versions of Pandas and Python. Unfortunately this library is not quite up to Pandas v2.x and needs much more support to progress and to cover more versions. 😐

Why Pandas 2.x offset aliases is not working as intended is beyond me as they look similar to Pandas 1.x offset aliases. 🤷🏼‍♂️

Perhaps the original pivots author @hamedf62 may have knowledge on how to address this issue.

Kind Regards KJ

twopirllc avatar Oct 17 '23 18:10 twopirllc

The issue comes about because both the resample() method of a pd.Series and df.index = df.index + Timedelta(1, anchor.lower()) could both previously accept Y and M, however only resample() accepts Y now

PR Raised

Rossco8 avatar Mar 08 '24 03:03 Rossco8

Hi @twopirllc, I'm just browsing to see if there are any issues i can help with and noticed this is still open. Can it be closed following the merge of the PR?

Rossco8 avatar Jul 22 '24 23:07 Rossco8

@Rossco8

Can it be closed following the merge of the PR?

Yeah probably. Can always reopen later if still unresolved.

Thanks for looking out. 😎

twopirllc avatar Jul 24 '24 18:07 twopirllc