-
Notifications
You must be signed in to change notification settings - Fork 9
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
Process Pandas Dataframe instead of list? #4
Comments
I was wrong, the Rust functions can actually already process pandas dataframes directly, the examples under However one runs then into another problem, since the functions return then another number of indices. This modified example doesn't work, unfortunately: print("Timing Panther:")
start = timer()
# data['EMA'] = ema(data['Close'], 4)
data['SMA'] = sma(data['Close'], 5)
end = timer()
print(timedelta(seconds=end-start))
# This does work, but is a dirty hack to fill the missing values with NaN:
print("Timing Panther:")
start = timer()
data['EMA'] = [np.nan] * 3 + ema(data['Close'], 4)
data['SMA'] = [np.nan] * 3 + sma(data['Close'], 4)
end = timer()
print(timedelta(seconds=end-start)) |
This occurs because the length of the EMA list generated is (length - period + 1). The first element is calculated by summing the (1:period) and then using that value for the subsequent values by using |
I think the Panther functions all need to be rewritten to fit seamlessly into a common workflow with Pandas dataframes, otherwise I don't think it makes much sense. Then you should do an honest(!) benchmark test against the other Python TA libraries that already exist:
|
Another suggestion: |
Usually Pandas Dataframes are used in all Python financial frameworks/workflows.
Is it possible to rewrite the Rust functions so that they can directly process a Pandas dataframe?
Currently everything has to be converted:
DataFrame
>List
>Panther
>List
>DataFrame
In addition, the
speed_tests
are not fully meaningful in this context, because the conversions to and from lists have to be counted.Add: I tried this out briefly. If you want to get it back into a pandas dataframe, all speed advantages are gone.
Can you show a real workflow example with a pandas dataframe?
The text was updated successfully, but these errors were encountered: