Skip to content

Commit a40a6ad

Browse files
authored
fix api version (#262)
1 parent 264fdc2 commit a40a6ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/purpose_and_scope.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,18 @@ latest version of the dataframe API specification. If the given
275275
version is invalid or not implemented for the given module, an
276276
error should be raised. Default: ``None``.
277277

278+
Example:
279+
278280
```python
279281
import pandas as pd
280282
import polars as pl
281283

282284

283-
df_pandas = pl.read_parquet('iris.parquet')
285+
df_pandas = pd.read_parquet('iris.parquet')
284286
df_polars = pl.scan_parquet('iris.parquet')
285287

286288
def my_dataframe_agnostic_function(df):
287-
df = df.__dataframe_consortium_standard__(api_version='2023.08-beta')
289+
df = df.__dataframe_consortium_standard__(api_version='2023.09-beta')
288290

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

299301
return df.dataframe
300302

@@ -304,8 +306,6 @@ my_dataframe_agnostic_function(df_polars)
304306
my_dataframe_agnostic_function(df_any_other_library_with_a_standard_compliant_namespace)
305307
```
306308

307-
Example:
308-
309309
### Checking a dataframe object for Compliance
310310

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

0 commit comments

Comments
 (0)