polars 0.0.0

DataFrame library
Documentation

Polars


In memory DataFrames in Rust

This is my mock up of DataFrames implemented in Rust, using Apache Arrow as backend.

WIP

Series

  • cast
  • take by index/ boolean mask
  • limit
  • Rust iterators!
  • append
  • aggregation: min, max, sum
  • arithmetic
  • comparison
  • find
  • sorting

DataFrame

  • take by index/ boolean mask
  • limit
  • join: inner, left
  • column ops: drop, select, rename
  • group by
  • concat (horizontal)
  • read csv
  • write csv
  • write json
  • read json
  • sorting

Data types

  • null
  • boolean
  • u32
  • i32
  • i64
  • f32
  • f64
  • utf-8
  • date
  • time

Example

use polars::prelude::*;

// Create first df.
let s0 = Series::init("days", [0, 1, 2, 3, 4].as_ref());
let s1 = Series::init("temp", [22.1, 19.9, 7., 2., 3.].as_ref());
let temp = DataFrame::new_from_columns(vec![s0, s1]).unwrap();

// Create second df.
let s0 = Series::init("days", [1, 2].as_ref());
let s1 = Series::init("rain", [0.1, 0.2].as_ref());
let rain = DataFrame::new_from_columns(vec![s0, s1]).unwrap();

// Left join on days column.
let joined = temp.left_join(&rain, "days", "days");
println!("{}", joined.unwrap())
           days           temp           rain
            i32            f64            f64
            ---            ---            ---

              0           22.1           null
              1           19.9            0.1
              2              7            0.2
              3              2           null
              4              3           nul