Skip to content

Commit 63864b5

Browse files
committed
addition of deleted file
1 parent 9b0811d commit 63864b5

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import narwhals as nw
2+
import polars as pl
3+
from data_generation import generate_data
4+
5+
polars_df = pl.DataFrame(data_generation(4))
6+
polars_df
7+
8+
pandas_df = polars_df.to_pandas()
9+
type(pandas_df)
10+
pandas_df
11+
12+
polars_df = pl.from_pandas(pandas_df)
13+
type(polars_df)
14+
polars_df
15+
16+
17+
def agnositic_groupby(df):
18+
return (
19+
nw.from_native(df)
20+
.group_by("region")
21+
.agg(nw.col("sales_income").sum())
22+
.sort("region")
23+
.to_native()
24+
)
25+
26+
27+
agnositic_groupby(pandas_df)
28+
29+
agnositic_groupby(polars_df)

0 commit comments

Comments
 (0)