Open manjrem opened 3 years ago
Hello @manjrem,
Thanks for using Pandas TA!
when trying to calculate values for all indicators using below code, the data by default gets appended to the dataframe and there is no option to override it. Using "append=False" does not work.
That is correct, the Strategy method, df.ta.strategy()
, does not have an append
option because it appends by default and thus append=True
or append=False
have no effect.
This makes it difficult to use this on streaming data.
To me, it does not seem difficult to drop the ohlcv et al columns if you do not need them after running df.ta.strategy('All', verbose=True, timed=True)
unless I am mistaken.
Do you have example code to illustrate the difficulty of removing the ohlcv et al columns post df.ta.strategy('All', verbose=True, timed=True)
?
In the end, Pandas TA can be modified to have an append
option if there is (a) enough users that want it included or (b) someone is willing to contribute that feature.
Kind Regards, KJ
the problem is not dropping ohlcv but the fact that all TA parameters get appended to source dataframe as default and there is no mechanism to override. this is not a problem for batch data, but for streaming stock prices it creates an error.
@manjrem,
this is not a problem for batch data, but for streaming stock prices it creates an error.
Is this error reproducible? It is rather hard to debug from scratch with no reproducible code to work from.
I'll poke around some. Unfortunately, a "simple fix" I tried was not so simple. Hopefully someone else also figured a way to disable and return just the results of the ta.strategy()
computations.
Out of curiosity, what and how are you streaming with? Any particular frameworks, packages, tutorials you recommend?
Kind Regards, KJ
@manjrem,
I believe it is fixed, but want your opinion. Please try out the development branch and let me know. It also has speed improvements, better documentation, and typing.
$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development
Kind Regards, KJ
Hello @manjrem,
I assume by no response that the solution provided was sufficient. Thus I will be closing this issue in a few days.
Kind Regards, KJ
Apologies for delay in responding.
Append==False does seem to be working. It is not adding any columns in the existing dataset when using data.ta.study('All', append=False, verbose=True, timed=True) but it does append columns when using data.ta.study('All', append=True, verbose=True, timed=True). This is expected.
I would have expected the TA calculations to be printed on screen though when using data.ta.study('All', append=False, verbose=True, timed=True) so that I could save it to a new dataset.
print(ta.version) 0.3.51b0
Hello @manjrem,
Hmm... I guess I missed something in your original request?
"append=False" should ensure that output of AllStrategy is not added to source dataframe
But you wanted the prior including: To print the TA results DataFrame to stdout?
I would have expected the TA calculations to be printed on screen though when using data.ta.study('All', append=False, verbose=True, timed=True) so that I could save it to a new dataset.
I want to clearly understand on how this is supposed to operate. 🤔 Are you planning to capture the results printed to stdout on your own? Or is it supposed to print to stdout
and return resultant the TA DataFrame? Is there anything else that I am missing?
So if the following code is executed,
import pandas_ta as ta
df = ta.df.ta.ticker("SPY", period="1y", timed=True)
df.ta.study(ta.CommonStudy, cores=0, append=False)
# Or should it be ran like this?
# tadf = df.ta.study(ta.CommonStudy, cores=0, append=False)
STDOUT What do you expect to have printed to the screen?
Any additional details would be appreciated. 😎
Thanks, KJ
Apologies for confusing you!!!
I was expecting that this would work similar to a "inplace" function (df.drop(['test'], inplace=True,axis=1)) in typical pandas data-frame.
If i mention "append=False" then the TA calculations should be printed on screen so that i can use them as an input for creating a new data-frame. While if I mention "append=True" then the existing/original data-frame gets updated.
Hey @manjrem,
I believe it is fixed this time. Please try out the development branch and let me know.
$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development
Thanks, KJ
@manjrem,
So, apparently using append=False
creates other Issues and I do not have the time to rebuild study and all it's supporting methods. The only work around has been append=None
.
You will need the latest development version or version 0.3.59b or higher.
Kind Regards, KJ
Hey @manjrem,
I believe it is fixed this time... finally! Please try out the development branch and let me know.
$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development
If you do not respond, I will be closing this issue.
Thanks, KJ
Thanks Kevin!Will test and respond in next two days.
Hi @twopirllc
df.ta.study("All", append=False) or df.ta.strategy("All", append=False) is working as expected.
Thank you so much for accommodating and incorporating the request.
The only things which seems amiss about the output is that the output of df.ta.strategy("All", append=False) is not getting assigned to df_neo when executing "df_neo = df.ta.strategy("All", append=False)"
Hey @manjrem,
df.ta.study("All", append=False) or df.ta.strategy("All", append=False) is working as expected.
Great! Also ta.strategy()
is depreciated in lieu of ta.study()
.
Thank you so much for accommodating and incorporating the request.
No problem. Thanks for your patience.
The only things which seems amiss about the output is that ...
I asked this exact question on 2/20:
Or is it supposed to print to
stdout
and return resultant the TA DataFrame?
You replied:
If i mention "append=False" then the TA calculations should be printed on screen so that i can use them as an input for creating a new data-frame.
Based on that response, I understood that the resultant TA did not need to be returned, only printed.
I do not have a time frame of when to attempt again with so many outstanding issues and other TA Lib indicators than need to be included before I make another Pypi release. Hopefully someone can help in between that time, so I will leave this open.
Kind Regards, KJ
Which version are you running? The lastest version is on Github. Pip is for major releases.
version == 0.3.14b0
Upgrade.
Describe the bug A clear and concise description of what the bug is. when trying to calculate values for all indicators using below code, the data by default gets appended to the dataframe and there is no option to override it. Using "append=False" does not work. This makes it difficult to use this on streaming data.
To Reproduce Provide sample code. df.ta.strategy('All', append=False, verbose=True, timed=True)
Expected behavior A clear and concise description of what you expected to happen. "append=False" should ensure that output of AllStrategy is not added to source dataframe.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Thanks for using Pandas TA!