Skip to content

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

Closed

Description

@mmuru

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.

Activity

  1. mmuru commented on Sep 15, 2021

    @mmuru
    ContributorAuthor

    @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.

  2. houqp commented on Sep 19, 2021

    @houqp
    Member

    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.

  3. drauschenbach commented on Nov 3, 2024

    @drauschenbach
    Contributor

    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.

  4. andygrove commented on Nov 3, 2024

    @andygrove
    Member

    Closing this. Thanks @drauschenbach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions