ta icon indicating copy to clipboard operation
ta copied to clipboard

ADX results in all nan when index of dataframe does not start at 1

Open scolemann opened this issue 5 years ago • 2 comments

The dataframe I passed into the adx method had been resampled and the indexes were something like 60,120,180.

On line 144: trs[0] = tr.dropna()[0:n].sum()

Due to my index starting at sixty, the series had no values after slicing and the sum was 0. This caused a divide by zero and created a nan. This caused din and dip to have the first value in the series be nan, which then resulted in all adx values being nan.

On line 145 there is a reset index. If this was moved prior to the sum for trs[0] it would resolve the issue. I'm not sure if there are other implications of doing that.

scolemann avatar Apr 10 '19 05:04 scolemann

Hi @scolemann ,

Could you provide me one dataset to test this behavior?

Thank you!

bukosabino avatar Nov 07 '19 22:11 bukosabino

I'm having a similar issue.

When I get a NaN series, I save off the data but then when I load the data and test it, it works correctly. I'm not sure what I'm doing differently to get the series of NaN values... I will update if I find anything.

lord-village avatar Sep 18 '20 12:09 lord-village