Giter Site home page Giter Site logo

devsgnr / breadroll Goto Github PK

View Code? Open in Web Editor NEW
63.0 3.0 0.0 11.26 MB

breadroll ๐ŸฅŸ is a simple lightweight library for data processing operations written in Typescript and powered by Bun.

Home Page: https://breadrolljs.vercel.app

License: MIT License

TypeScript 98.83% JavaScript 0.99% Shell 0.18%
csv csv-parser data-engineering data-science tsv tsv-parser eda exploratory-data-analysis bun data-transformation

breadroll's Introduction


npm breadroll test status breadroll test status GitHub Stars

breadroll ๐ŸฅŸ is a simple lightweight toolkit for parsing csv, tsv, and other delimited files, performing EDA (exploratory data analysis), and data processing operations on multivariate datasets. Think pandas but written in Typescript and developed on the Bun Runtime.


  • โšก Fast: breadroll is built on Bun, the all-in-one Javascript runtime built for speed
  • ๐Ÿ“ File I/O: Support for local & remote sources loved by JS developers - Local, HTTPS, & Supabase Storage
  • ๐Ÿ˜Š Easy-to-use: Compose queries using filter keywords that are simple and are easy to comprehend

Table of Content

  1. Introduction
  2. API Reference
  3. Changelog

Installation

System Requirements:

  • Bun
  • MacOS, Linux
  • Typescript >= 5.1

Bun

breadroll is built on and optimized for Bun.js. You can install Bun by running the following

curl https://bun.sh/install | bash

create a new Bun project by running

bun init

then you can now install breadroll using

bun add breadroll

Easy API

breadroll provides an easy to use API that gets you from zero to data processing in no time, with lazy loading of these delimited files via Bun's File I/O Bun.file(), the file parsed based on the DataframeReadOptions, and convert into a Dataframe, and easily read out the content of the Dataframe using .value.

import Breadroll, { Dataframe } from "breadroll";
const csv: Breadroll = new Breadroll({ header: true, delimiter: "," });

Example: From one instance example above, you can open multiple csv files

const df: Dataframe = await csv.open.local("./data/ds_salaries.csv");

Remote Data Sources

breadroll makes it easy to work with remote data sources with current support for HTTPS and Supabase Storage. With other remote data sources on the roadmap.

const df: Dataframe = await csv.open.https("https://.../.../filename.csv");
const df: Dataframe = await csv.open.supabaseStorage("bucketName", "filepath");

Filtering

Peform complex filtering; with various filters including range filters like is between that can be achieved using an optional function parameter limit which is the upper limit. These range filter are only effective with numbers (integers, floating-point).

df.filter("age", "is between", 30, 40);

Perform even more complex filtering with multiple / chained filter, you can chain the filter ie. filtering the previously filtered Dataframe, the chained filter can be as long as you need them to be.

df.filter("age", "is between", 30, 40)
  .filter("salary", ">", 70000)
  .filter("work_year", "==", 2020);

Data Transformation

Perform whatever transformation you'd like to perform on the value of a specified column, from simple transformation like value + 2, to complex mathematical transformations that can be paired with the in-built numeric constant object

df.apply({ key: "salary", fn: (v) => v / (40 * 4), newkey: "per_hour" });

A Little Math

Get a single number that accurately represents the underlying data with the many provided aggregation functions, the likes of average (mean), max, min, sum, count, etc. with more in development

df.sum("capital_gain")
df.average("capital_gain")
df.count

This project running on bun v1.0.22. Bun.js is a fast all-in-one JavaScript runtime.

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.