Giter Site home page Giter Site logo

zebras's Issues

Convert to AMD module

Convert zebras.js to an AMD module so z = require('zebras') will work on Observable rather than having to do z = require('https://bundle.run/zebras).

Implement map for groupby objects

It would be cool to have a way to map groupby objects. It could preserve the same keys and map the values, just like ramda's map, or just get the values to get a dataframe-like result, roughly like:

function apply(fn, df){
  return R.pipe(
    R.mapObjIndexed((value, index) => fn(value, index)),
    R.values
  )(df)
}

Question about `head` and `tail`

It's not super straightforward that these methods print something as a string. Wouldn't it be more useful and clear to have them return a subset of df (similarly to filter)?

Then printing of head or tail could be done via Z.print(Z.head(10, df)) which is more clear on the intent? Or it could also be encapsulated in print-specific helpers: printHead and printTail.

Side note, there is console.log() lingering in tail:

console.log(print(truncated))

Make zebras browser friendly

Right now Zebras is intended for use either in Jupyter notebook or in ObservableHQ. But there might be a value in allowing it to be used in the browser as well. To be able to use some of its methods inside web applications, etc.

It seems that it wouldn't be too difficult to make it happen, the main blocker right now seems to be that everything is in one file and it uses the file system:

const fs = require("fs")

An idea could be to modularise it exposing methods as individual exports. This also has the perk of improved maintainability going forward instead of cramming more functionality into one file. Similarly to how Ramda is structured.

It'd be also advised, maybe as next step and not right away, to introduce a build step to produce different kinds of dist bundles (es6, cjs, umd).

Add tests

I think it would be great to have tests. It would be a good next step, before further planned refactoring, to have a piece of mind that nothing gets broken in the process.

If you didn't already, I could add a testing setup with mocha and start adding tests until we get full coverage.

What do you think?

Sort df by multiple columns

Change z.sortByCol(columnName, direction, df) so that it accepts an array of column names and sorts a df by the specified columns, giving precedence to columns listed earlier, as in pandas.

Implement merge

Implement function to join dataframes on columns. See pandas implementation here.

gbCount, gbMean etc. not curried

Hi,

It seems that you can't do a pipe like this:

const data = [{"Day": "Monday", "value": 10}, {"Day": "Tuesday", "value": 5}, {"Day": "Monday", "value": 7}]

Z.pipe([
  Z.groupBy(s => s.Day),
  Z.gbSum('value') // Uncaught TypeError: g.call is not a function
])(data)

It's because the gbSum function (and the other gb funcs) is not curried?

Proposal: Move TODO.md to issues on GitHub

First off, I love this tool, would love to contribute!

Personally, I like to work with GitHub issues rather than a TODO.md file, since it's easier to reference in PR's/comments. Contributors could also comment on the issue if they want to work on it, which is a little harder to do in a committed file. Also, tagging issues with feature or bug can be pretty helpful!

Does not import data with a comma in them

Excel surrounds these with cases with quotations when it is in a CSV. Zebras seems to just ignore these rows of data. This could be a user error. Please comment if you know a fix.

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.