Giter Site home page Giter Site logo

Comments (10)

HarlanH avatar HarlanH commented on July 19, 2024

we've got stack/unstack. Someone should sit down and try to figure out if that's good enough or if we need additional functionality.

from dataframes.jl.

StefanKarpinski avatar StefanKarpinski commented on July 19, 2024

I'm sure you guys are aware of the [reshape] and [reshape2]. Also worth considering is the find/sparse functions in Matlab that kind of do similar things and are a really classic design.

from dataframes.jl.

johnmyleswhite avatar johnmyleswhite commented on July 19, 2024

I find that the stack / unstack API is much less helpful than the cast / melt API. At some point, I'd like to go through and clean this up.

from dataframes.jl.

tshort avatar tshort commented on July 19, 2024

The existing stack(df, ["colX", "colY"] is equivalent of Hadley's melt(df, measure.vars = c("colX", "colY"). I added versions of melt and melt_df that use stack and stack_df. The only difference really is that the melt functions prefer id_vars.

That was the easy part. cast is the tough one.

from dataframes.jl.

johnmyleswhite avatar johnmyleswhite commented on July 19, 2024

It would be really nice to use id_vars instead. That's just a set complement, right?

from dataframes.jl.

tshort avatar tshort commented on July 19, 2024

Yes it is. That's what the new melt does. If df has columns x1 through x4, melt(df, ["x1", "x2"]) is the same as stack(df, ["x3","x4"]). Both functions also allow three arguments.

from dataframes.jl.

johnmyleswhite avatar johnmyleswhite commented on July 19, 2024

Ah. Much better! This is looking really promising.

from dataframes.jl.

tshort avatar tshort commented on July 19, 2024

More changes here. I added a simplistic pivot_table function. The purpose is like Hadley's dcast or Wes's pivot_table. The format is pivot_table(d, R, C, D, fun) where R and C are vectors indicating columns that are to be pivoted to either rows or columns in the results. D is the column to take for data. fun is the function to apply to aggregate (defaults to mean if left off).

from dataframes.jl.

tshort avatar tshort commented on July 19, 2024

Also, I changed to argument order for unstack to match that of pivot_table.

from dataframes.jl.

tshort avatar tshort commented on July 19, 2024

I'm closing as we've got most basics between stack, unstack, melt, and pivot_table. pivot_table is like Hadley's cast. It's still fairly limited, so folks can add specific feature requests.

from dataframes.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.