Giter Site home page Giter Site logo

Add flatten to DataAPI.jl about dataapi.jl HOT 6 OPEN

juliadata avatar juliadata commented on June 13, 2024
Add flatten to DataAPI.jl

from dataapi.jl.

Comments (6)

andyferris avatar andyferris commented on June 13, 2024

Cool - this is an interesting package. I can see how this could remove friction for users.

Just a thought - for functions that are widely useful, are present in other languages standard libraries, and have an unambiguous definition for Vector (like mapmany and flatten) could we first attempt to put them into Base?

from dataapi.jl.

bkamins avatar bkamins commented on June 13, 2024

I think it might be possible, but I think that adding things to Julia Base has been recently restricted a lot. Also, even if we added them, they would most likely not go into the next Julia LTS, which means that we would wait several years to be sure everyone has it in Julia Base. I think the benefit of DataAPI.jl is that it allows for a much quicker development cycle as we would only add e.g.:

function flatten end

here so we do not have to promise any specific API (except for specification of a general meaning of the function).

from dataapi.jl.

nalimilan avatar nalimilan commented on June 13, 2024

Am I right that SplitApplyCombine.flatten(x) is equivalent to collect(Iterators.flatten(x))?

DataFrames.flatten(df, cols) is a bit different I would say. In particular, if we consider data frames as collections of rows, SplitApplyCombine.flatten(df) should return a (flat) collection of all cells in df. The flatten(df, cols) method doesn't fit very well in that approach -- though it's not incompatible either.

from dataapi.jl.

bkamins avatar bkamins commented on June 13, 2024

Indeed. The issue is to avoid name clashes when both DataFrames.jl and SplitApplyCombine.jl are both loaded in a session (which is relatively common for advanced usage scenarios). What would you do in such a case?

from dataapi.jl.

andyferris avatar andyferris commented on June 13, 2024

That sounds right.

I assumed you used flatten(gdf) for nested (grouped) data frames?

The cols version “feels” like to me a lot some flavour of a SpltApplyCombine.mapmany call which is what flatten is ultimately defined as. You are automatically keeping (broadcasting?) the columns which aren’t mentioned, right?

from dataapi.jl.

bkamins avatar bkamins commented on June 13, 2024

I assumed you used flatten(gdf) for nested (grouped) data frames?

It is just DataFrame constructor

You are automatically keeping (broadcasting?) the columns which aren’t mentioned, right?

Right

from dataapi.jl.

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.