-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test.pandas() - ValueError: The truth value of a DataFrame is ambiguous #53
Comments
Do you have a traceback I can look at? |
Thks for quick reply! Here's my code and traceback: import talib as t, pandas as pd Traceback (most recent call last): |
Okay, the support for pandas hasn't been released as import talib as t, pandas as pd
import traceback
df = pd.read_csv('http://ichart.finance.yahoo.com/table.csv?s=SPY&d=0&e=27&f=2014&g=d&a=0&b=29&c=1993&ignore=.csv')
df.columns = [s.lower() for s in df.columns] # ta-lib looks for "open" not "Open", etc.
sma = t.abstract.SMA
sma(df, 20) Right now the only problem I saw was that ta-lib is looking for lowercase column names, like "open" and "close", not "Open" and "Close"... Want to try the latest master (should be very stable) and see what you think? |
If it works for you, I can do a 0.4.8 release since I was planning one anyway and this would be nice to check working first. |
I'd like to try the latest master but can't seem to install it (64 bit system) - it stops while building 'talib.common' extension, but no error message : see below. Do I need VS to do a build? E:\Downloads\ta-lib-master>python setup.py install |
It should have the same requirements as easy_install. Should be VS to build c extension, and cython possibly because the setup.py uses it of the C files are out of date. |
Looks like there was an error message that didn't paste? |
No, there was no more to paste. But I tried this and got a bit further - E:\Downloads\ta-lib-master>python setup.py build -c mingw32 |
So you're trying to build with mingw32's gcc? I haven't tested that combination -- is it saying gcc isn't found? |
So now I have the same problem another user had a year ago: alex314159 commented a year ago ok some progress here - I uninstalled Python 64bit and replaced by the 32bit version and it seems to go a lot further into the process (in particular the file above is no longer a problem) I now get a bunch of these warnings: C:\Python27\Scripts\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\talib.o build\temp.win32-2.7\Release\talib.def -Lc:\ta-lib\c\lib -LC:\Python27\l followed by: c:\ta-lib\c\lib/ta_libc_cdr.lib(../../../../../temp/cdr/ta_HT_TRENDMODE.obj):(.text[TAHT_TRENDMODE]+0x7eb): undefined reference to _ftol2_sse' he 'solved' the problem by using the VS2008 C compiler instead of mingw32. Unfortunately I don't have that compiler and it seems it's no longer available - do you possibly know where I could find a copy? Which compiler did you use? |
Hmm, I just used whatever free VS edition is available from MS. I'm curious how easy_install worked for you but "doing it by hand" is having problems. My could try releasing 0.4.8 and you could try easy_install? (It's not like the C code that cython generates is complicated, sounds more like a configuration problem on Windows) |
alex314159 solved it by using easy_install - but he had a copy of the vs2008 compiler! I'm still stuck with the same problem he experienced, as above. I think the problem is the -lmsvcr90 in the command line. There are too many unresolved references to `_ftol2_sse' c:\ta-lib\c\lib/ta_libc_cdr.lib(../../../../../temp/cdr/ta_HT_TRENDLINE.obj):(.t Any idea what library -lmsvcr90 is linking to? |
No, sorry. However I just released master as 0.4.8 if you want to try easy_install. |
Tried 0.4.8 with easy_install - same error. Guess I'll just wait 'til Christoph Gohlke makes a new binary.... I have a workaround to use pandas in the meantime. |
Oh, I didn't know you installed from a binary -- thats interesting. Frustrating that install from source is always so difficult on Windows... sorry! |
Hi, I get the same error: File "/home/david/git/pypredict/create_dataset_classifier.py", line 38, in overlap_studies I built talib on Xubuntu 64 bit from master about a week ago. I use lowercase column names. Here is my code: Is this the same issue as scubamut was having? |
Hmm, it's possible that this check (https://github.com/mrjbq7/ta-lib/blob/master/talib/abstract.pyx#L400) should be If you use a |
I tried using Series as follows, forgive my newness to python:
using:
No change to the problem. |
I tried making the change you suggested,
Ideas? |
Haha, github shouldn't close automatically for "try and fix" messages! Anyway, maybe you can try the current master and see if it fixes your problem? |
I checked it out but still get these errors I ran this successfully before, cannot understand what is different except I installed a bunch of python libs as follows:
Not sure any of these would alter things at all? |
Hmm, maybe you should try "make clean" then make, see if it works without errors before trying to install it? It will clean build output and then build in-place. |
I tried this
It passed fine but I got the same errors when running Maybe a gcc update by Xubuntu since I last did it? Seems unlikely |
Odd, but if you ran make install, should have installed it for you - does your test case pass? |
No it does not pass, Maybe if I change the args passed in I can use the original one? I use this to build inputs Then if I call say BBCODE like this Here is the example using MIDPRICE
My understanding is that inputs.values converts from a DataFrame to an ndarray, which according to the README.me that is what is expected. |
Hi, is there any reason that talib does not accept "Close" but "close"? It could be easily interchanged internally anyway. |
Hi @fanbin, we just defaulted to lowercase column names, it is probably not too difficult to change this if it is needed. Are you looking to use titlecase (e.g., |
If it's so easy to implement at core, how is it so hard to implement as a layer around core. Just a little food for thought. Sort of an "If core doesn't want bloat, and it's easy to do - why not only run that branch when you definitely need to run it" sort of thing. |
I'm trying to use ta-lib with pandas, but get error (running pandas.test()):
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
The text was updated successfully, but these errors were encountered: