File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -275,16 +275,18 @@ latest version of the dataframe API specification. If the given
275275version is invalid or not implemented for the given module, an
276276error should be raised. Default: `` None `` .
277277
278+ Example:
279+
278280``` python
279281import pandas as pd
280282import polars as pl
281283
282284
283- df_pandas = pl .read_parquet(' iris.parquet' )
285+ df_pandas = pd .read_parquet(' iris.parquet' )
284286df_polars = pl.scan_parquet(' iris.parquet' )
285287
286288def 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)
304306my_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
311311Dataframe-consuming libraries are likely to want a mechanism for determining
You can’t perform that action at this time.
0 commit comments