Giter Club home page Giter Club logo

Comments (5)

wjones127 avatar wjones127 commented on June 3, 2024

Hmm if I could I would add a flatten parameter to to_pandas(), but we don't control that method (it's in PyArrow).

Other DataFrames do have decent support for nested columns, such as Polars. So I don't think flattening in general is what we want.

Perhaps we can provide a helpful snippet to teach them how to unflatten a column? IIRC it's just something like:

df.assign(nested = lambda df: [x['key'] for x in df['struct']])

from lance.

changhiskhan avatar changhiskhan commented on June 3, 2024

@pchalasani i think we can do this in LanceDB repo instead of the format level (please see the referencing PR)

from lance.

pchalasani avatar pchalasani commented on June 3, 2024

Nice, thanks, I seem to be conflating the two repos in my mind 😀

from lance.

wjones127 avatar wjones127 commented on June 3, 2024

For future reference for Lance users, you can write:

dataset.to_table(...).flatten().to_pandas()

If you have multiple levels of nested fields, you may need to call flatten() multiple times.

Maybe I can make this a tip in the user guide?

from lance.

pchalasani avatar pchalasani commented on June 3, 2024

from lance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.