-
-
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
feat(python): handle Series init from python sequence of numpy arrays #5918
feat(python): handle Series init from python sequence of numpy arrays #5918
Conversation
Awesome! I am working in some voodoo that allows us to put python objects in an arrow struct. Then both issues are solved. :) |
It's a Christmas miracle, heh :) Side-query on supported arrow types; does arrow2/rust handle |
They do. We need to add a i128 primitive chundedarray and a decimal logical type on the polars side to make this work. |
Oooo... ok, that's interesting. |
Why do I only get the "Before" result? |
Because you are running a old version. Latest version is 0.16.11 at the moment. |
Ok, that helps. It solves that I now get the list[i64] instead of the object. |
So what is the output you get then? import polars as pl
print(pl.show_versions())
df = pl.DataFrame({
"colx": [np.array([1,2,3]), np.array([4,5,6])],
})
print(df)
df_struct = df.select(
[pl.struct(["colx"])]
)
print(df_struct) |
---Version info--- |
df.select( is differenf from your df_struct = df.select( |
To me it looks like you get the |
Yes. due to: I don't know if I should post this here (relativ new to software engineering and github). I'm refactoring my jupyter notebook into python code. ---Version info--- And the example as above works as it should. In my code I collect data and put that into a polars dataframe. Why do I get different results for Center_of_Mass and Matrix_of_Inertia inputs? |
Without an input dataframe as example it is hard to say what is happening. |
There is no input dataframe: The thing now is that I created a small notebook to replicate this result, and replaced all of my computation with just the numpy.ndarrays. "Strangely" I get 3 times a list[f64] as output. Learning every step on the way, I'll have to do some work and test. P.S.: How can I convert a column within the dataframe from object to struct? Thanks. |
Closes #5905.
We already handle
Series
init from 2D numpy arrays; this PR extends that slightly so that we can also recognise/handle init from a python sequence (list/tuple) of numpy arrays.Before
After