Open librasteve opened 1 year ago
These tables compare the API methods:
Function | Description | Pandas | Polars | Dan |
---|---|---|---|---|
vstack | Stack vertically | pd.concat([df1, df2], axis=0) |
pl.vstack([df1, df2]) or pl.concat([df1, df2]) |
df1.concat(df2) |
hstack | Stack horizontally | pd.concat([df1, df2], axis=1) |
pl.hstack([df1, df2]) or pl.concat([df1, df2], how="horizontal") |
df1.concat(df2, :axis(1)) |
concat | Concatenate along an axis | pd.concat([df1, df2], axis=0/1) |
pl.concat([df1, df2], axis=0/1) |
df1.concat(df2, axis=>0/1) |
join | Join on a column | df1.join(df2, on="col") or pd.merge(df1, df2, how="inner", on="col") |
df1.join(df2, how="inner", on="col") |
df1.join(df2, how=>'inner', on=>'col') |
Function | Description | Pandas | Polars | Dan |
---|---|---|---|---|
concat | Append one Series to another | n/a | n/a | series1.concat( series2 ) |
append | Append one Series to another | series1.append(series2) |
n/a | series1.concat( series2 ) |
join | Join Series on index | series1.join(series2, how='inner') |
pl.join([series1, series2], on='index_column') |
n/a |
Sources:
The solution is:
Function | Description | Dan |
---|---|---|
concat | Concatenate along an axis | df1.concat(df2, axis=>0/1) |
join | Join on a column | df1.join(df2, how=>'inner', on=>'col') |
Function | Description | Dan |
---|---|---|
concat | Append one Series to another | series1.concat( series2 ) |
Notes:
Dan::Polars
Dan
this issue to weigh the benefit of implementing as splice & concat for Dan::Polars
and thus to mask Dan splice & concat
Series
s.concat: t;
concat
pub fn append(&mut self, other: &Series);
these are both "in place"
DataFrame
Dan has ...
Polars has...
Options
Conclusion
In the light of implementation, it appears the best common solution is to take a 3rd path that replaces this method zoo with
.concat
and.join
. This is detailed below....