Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.DataFrame.__dataframe__#

DataFrame.__dataframe__(nan_as_null=False,allow_copy=True)[source]#

Return the dataframe interchange object implementing the interchange protocol.

Parameters:
nan_as_nullbool, default False

nan_as_null is DEPRECATED and has no effect. Please avoid usingit; it will be removed in a future release.

allow_copybool, default True

Whether to allow memory copying when exporting. If set to Falseit would cause non-zero-copy exports to fail.

Returns:
DataFrame interchange object

The object which consuming library can use to ingress the dataframe.

Notes

Details on the interchange protocol:https://data-apis.org/dataframe-protocol/latest/index.html

Examples

>>>df_not_necessarily_pandas=pd.DataFrame({'A':[1,2],'B':[3,4]})>>>interchange_object=df_not_necessarily_pandas.__dataframe__()>>>interchange_object.column_names()Index(['A', 'B'], dtype='object')>>>df_pandas=(pd.api.interchange.from_dataframe...(interchange_object.select_columns_by_name(['A'])))>>>df_pandas     A0    11    2

These methods (column_names,select_columns_by_name) should workfor any dataframe library which implements the interchange protocol.


[8]ページ先頭

©2009-2025 Movatter.jp