Skip to content
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

ops.Ge has valueError when one of the operand is $close #657

Closed
bbbzhai opened this issue Oct 26, 2021 · 5 comments
Closed

ops.Ge has valueError when one of the operand is $close #657

bbbzhai opened this issue Oct 26, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@bbbzhai
Copy link

bbbzhai commented Oct 26, 2021

Hi,
I am trying to use ops.ge (greater equal than operator), it will gives

ValueError: Can only compare identically-labeled Series objects

I tried with other variables, it's fine.

Same issue with ops.Gt, ops.Le, ops.Lt

@bbbzhai bbbzhai added the bug Something isn't working label Oct 26, 2021
@zhupr
Copy link
Collaborator

zhupr commented Oct 27, 2021

@bbbzhai Hi,
How do you use it, you can refer to the following usage:

fields = ["Ge($close, 1)", "Gt($close, 1)", "Le($close, 1)", "Lt($close, 1)"]
df = D.features(D.instruments("all"), fields)
# or 
fields = ["$close >= 1", "$close > 1", "$close <= 1", "$close < 1"]
df = D.features(D.instruments("all"), fields)

@bbbzhai
Copy link
Author

bbbzhai commented Oct 27, 2021

@zhupr
Hi, I tried with your example, it works. I also try 'Gt($close, $open)', this also works.
It failed with my case when I compare $close and other features that I created. Do not know why this is happening.
For example, if I created a feature called ema_5, then when I do 'Gt($close, $ema_5)', it would fail. But if I do: 'Gt($close, EMA($close, 5))', this is working.
I think it has something to do with Nan. But if I try 'Gt($ema_5, $ema_10)' (both are features that I created), and this also works.
So I'm confused in why this is happending

@zhupr
Copy link
Collaborator

zhupr commented Oct 27, 2021

@zhupr Hi, I tried with your example, it works. I also try 'Gt($close, $open)', this also works. It failed with my case when I compare $close and other features that I created. Do not know why this is happening. For example, if I created a feature called ema_5, then when I do 'Gt($close, $ema_5)', it would fail. But if I do: 'Gt($close, EMA($close, 5))', this is working. I think it has something to do with Nan. But if I try 'Gt($ema_5, $ema_10)' (both are features that I created), and this also works. So I'm confused in why this is happening

  • You can try: Gt(EMA($close, 5), EMA($close, 10))

Or,

@bbbzhai
Copy link
Author

bbbzhai commented Oct 28, 2021

@zhupr
I did use the dump feature to convert all my variables to qlib format. Don't know why it doesn't work.

@zhupr
Copy link
Collaborator

zhupr commented Oct 28, 2021

@zhupr I did use the dump feature to convert all my variables to qlib format. Don't know why it doesn't work.

If you are converting all data, replace dump_fix with dump_all

This PR(#659) will help you find the cause of the ops.Ge error

@bbbzhai bbbzhai closed this as completed Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants