Giter Club home page Giter Club logo

Comments (3)

ivirshup avatar ivirshup commented on September 18, 2024

Could you share your use case for this?

To me, storing a pandas Series is basically the same thing as storing a 1d xarray DataArray. I want to support storing xarray object, and I don't want to have two ways to store the same thing.

Would making this a single column dataframe on your end work here?

from anndata.

JWatter avatar JWatter commented on September 18, 2024

Thanks for the quick response! I am gonna argue a bit for the pandas series :)

My immediate use case is serializing a mapping between coarse and fine categories which are also columns of .obsm dataframes. A pandas series is the natural object to use for this.

In principle, using a single column dataframe would work, as would using a plain dictionary. But both would be hacky. The cleaner way is using a pandas series. As far as I know pandas is the de facto standard for storing labeled 1d and 2d arrays. The labeled 2d arrays are already supported as pandas dataframe.

I do understand that it is somewhat redundant to have two ways to store the same thing. Then again, if you support xarray objects, then you introduce a second way of storing 2d labeled arrays as pandas dataframes are already supported, right?

Except for serialization a pandas series in .uns works just fine. One could restrict the types to write in .uns, or construct xarrays whenever pandas series or dataframes (or python dicts) are written into .uns. Personally, I would prefer the flexibility and symmetry in the support of pandas dataframes and pandas series.

.... Just some thoughts, what do you think?

from anndata.

ilan-gold avatar ilan-gold commented on September 18, 2024

Good to look back once xarray support lands

from anndata.

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.