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

[Python]: Expose Dataframe.schema() to Python binding #1007

Closed
mmuru opened this issue Sep 15, 2021 · 4 comments
Closed

[Python]: Expose Dataframe.schema() to Python binding #1007

mmuru opened this issue Sep 15, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@mmuru
Copy link
Contributor

mmuru commented Sep 15, 2021

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and why for this feature, in addition to the what)

In Python, trying to get schema from Dataframe but it is not available in Python binding. Ideally, we should expose all the dataframe methods in Python binding.

Describe the solution you'd like
A clear and concise description of what you want to happen.
In Python, I should able to get schema from dataframe.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@mmuru mmuru added the enhancement New feature or request label Sep 15, 2021
@mmuru
Copy link
Contributor Author

mmuru commented Sep 15, 2021

@houqp: I reviewed the current implementation schema() in dataframe_impl.rs and it returns &DFSchema. In Python, how do I return it? Please, review this request and provide your feedback. Thanks.

@houqp
Copy link
Member

houqp commented Sep 19, 2021

I haven't put a lot of thought into this, so take it with a grain of salt ;)

I think one possible solution would be creating a new wrapper struct that wraps the DFSchema type within the python crate, then annotate it with pyclass (https://pyo3.rs/master/class.html#defining-a-new-class) so the wrapper type can be returned directly to python. You won't be able to return a reference to python, so you need to clone the &DFSchema reference and store it inside the wrapper struct.

@drauschenbach
Copy link
Contributor

drauschenbach commented Nov 3, 2024

This appears to be resolved. In datafusion-python, I can call df.schema(). In any case, this concern has moved to the datafusion-python git repo.

@andygrove
Copy link
Member

Closing this. Thanks @drauschenbach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants