librasteve / raku-Dan-Polars

Raku Polars binding
Artistic License 2.0
5 stars 2 forks source link

As::Query Design Notes #11

Open librasteve opened 1 year ago

librasteve commented 1 year ago

As the implementation of DataFrame and Series contexts and transformations matures, there is a potential to combine the slightly different APIs of Python-Pandas and Rust-Polars and unify them with the initial implementation of Raku-Dan. So the Dan API v1.0 will change to the Dan API v1.1.

This post seeks to compare and contrast the various API alternatives and to nail down the unified interface definition for this new API version.

1. Dan API v1.0

novel (vs. raku Array)

2. Dan::Polars API v1.1

Method Example Notes
series df.series() [~column]
select df.select([col("sepal.length"), col("variety")]) :(Expr @cols)
with_columns df.with_columns([col("variety").alias("newnew")]) :(Expr @cols) [~add]
drop df.drop(["sepal.length", "variety"]) :(Str @cols) [tbd]
groupby df.groupby(["variety"]).agg([col("petal.length").sum]) :(Str @cols)
agg ^^^ :(Expr @cols)
filter [aka grep]
sort
concat dfa.concat( dfc ) adapted Python(Pandas|Polars) [~concat]
join
=> !methods
column df.column("sepal.length") [~series]
with_column df.with_column($se.rename("newcol")) special case of add/with_columns [n]
collect

3. Next Action