Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,18 @@ latest version of the dataframe API specification. If the given
version is invalid or not implemented for the given module, an
error should be raised. Default: ``None``.

Example:

```python
import pandas as pd
import polars as pl


df_pandas = pl.read_parquet('iris.parquet')
df_pandas = pd.read_parquet('iris.parquet')
df_polars = pl.scan_parquet('iris.parquet')

def my_dataframe_agnostic_function(df):
df = df.__dataframe_consortium_standard__(api_version='2023.08-beta')
df = df.__dataframe_consortium_standard__(api_version='2023.09-beta')

mask = df.get_column_by_name('species') != 'setosa'
df = df.filter(mask)
Expand All @@ -294,7 +296,7 @@ def my_dataframe_agnostic_function(df):
continue
new_column = df.get_column_by_name(column_name)
new_column = (new_column - new_column.mean()) / new_column.std()
df = df.insert(loc=len(df.get_column_names()), label=f'{column_name}_scaled', value=new_column)
df = df.insert_column(new_column.rename(f'{column_name}_scaled'))

return df.dataframe

Expand All @@ -304,8 +306,6 @@ my_dataframe_agnostic_function(df_polars)
my_dataframe_agnostic_function(df_any_other_library_with_a_standard_compliant_namespace)
```

Example:

### Checking a dataframe object for Compliance

Dataframe-consuming libraries are likely to want a mechanism for determining
Expand Down