-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Is it possible to create a dataframe from row-like (Vec<Struct>) data? #1111
Comments
Yes I think it is necessary that I also have the same data processing requirements to add a new row to the dataframe |
Haha.. congrats on the number. You can use from_rows. If performance is important, I'd recommend to see if you can still create data in a columnar fashion with the builders. |
Dank u. Ik ben Australisch |
Bit confused as how to cast of convert to rows to supply an argument to from_rows |
Jep, Nederlands. 😄 A |
Thanks. Sorry for being a pest. How do I enumerate row by row? |
How do you mean? What do you want to do? |
Let's say we have a dataframe. How would one go about iterating over it by row? i.e (this is not the way to do it but will suffice in explaining what I'm trying to do) for (idx, row) in df.iter().unwrap().enumerate() {
let { close_time, close_price } = row;
} |
You can use get_row to access by index. This however quite slow as the data is layed out columnar in memory. Every row access comprises many cache misses. Often the same goal can be acquired in a columnar fashion. In you're case, I'd first select the Ideally I would also do the arithmetic on columns. |
Okay, cheers I understand now.
Dank je
…On Mon, 9 Aug 2021, 1:19 am Ritchie Vink, ***@***.***> wrote:
You can use get_row
<https://pola-rs.github.io/polars/polars/frame/struct.DataFrame.html#method.get_row>
to access by index. This however quite slow as the data is layed out
columnar in memory. Every row access comprises many cache misses.
Often the same goal can be acquired in a columnar fashion. In you're case,
I'd first select the close_time and close_price columns and work on them.
Ideally I would also do the arithmetic on columns.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1111 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSK646LSQK24U5632AXKU3T32N7DANCNFSM5BXKGB7Q>
.
|
Hi,
Is it possible to create a dataframe from row-like (Vec) data?
i.e A vec of OHLCFrame?
Cheers.
Also, I have a pretty cool issue number :)
The text was updated successfully, but these errors were encountered: