Skip to content

Commit

Permalink
remove some redundant comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jun 1, 2024
1 parent 6edefbc commit 3487a67
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions docs/basics/dataframe.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ Make a Python file with the following content:
import narwhals as nw

def func(df_any):
# 1. Create a Narwhals dataframe
df = nw.from_native(df_any)
# 2. Use the subset of the Polars API supported by Narwhals
df = df.select(
a_sum=nw.col('a').sum(),
a_mean=nw.col('a').mean(),
a_std=nw.col('a').std(),
)
# 3. Return a library from the user's original library
return nw.to_native(df)
```
Let's try it out:
Expand Down Expand Up @@ -68,11 +65,8 @@ Make a Python file with the following content:
import narwhals as nw

def func(df_any):
# 1. Create a Narwhals dataframe
df = nw.from_native(df_any)
# 2. Use the subset of the Polars API supported by Narwhals
df = df.group_by('a').agg(nw.col('b').mean()).sort('a')
# 3. Return a library from the user's original library
return nw.to_native(df)
```
Let's try it out:
Expand Down Expand Up @@ -112,11 +106,8 @@ Make a Python file with the following content:
import narwhals as nw

def func(df_any):
# 1. Create a Narwhals dataframe
df = nw.from_native(df_any)
# 2. Use the subset of the Polars API supported by Narwhals
df = df.with_columns(a_plus_b=nw.sum_horizontal('a', 'b'))
# 3. Return a library from the user's original library
return nw.to_native(df)
```
Let's try it out:
Expand Down

0 comments on commit 3487a67

Please sign in to comment.