Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As::Query Design Notes #11

Open
1 of 3 tasks
librasteve opened this issue Feb 10, 2023 · 0 comments
Open
1 of 3 tasks

As::Query Design Notes #11

librasteve opened this issue Feb 10, 2023 · 0 comments

Comments

@librasteve
Copy link
Owner

librasteve commented Feb 10, 2023

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

  • As::Array is the default API, with:
    • 2d data delegation
    • [cascading] accessors
    • elems
    • shape
    • splice (deprecate, see below)
  • As::Query
    • concat
    • sort
    • filter [grep]

novel (vs. raku Array)

2. Dan::Polars API v1.1

  • As::Array is same as Dan
  • As::Exprs is new (col prerequisite for As::Query, or spoof)
  • As::Query is based on Polars examples, with following
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

  • implement new drop, refactor, submethods to Dan::Polars
  • move As::Query to role
  • circle back to match in Dan & Dan::Pandas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant