Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Classe « DataFrame »

Méthode pandas.DataFrame.__dataframe__

Signature de la méthode __dataframe__

def __dataframe__(self, nan_as_null: 'bool' = False, allow_copy: 'bool' = True) -> 'DataFrameXchg' 

Description

help(DataFrame.__dataframe__)

Return the dataframe interchange object implementing the interchange protocol.

Parameters
----------
nan_as_null : bool, default False
    `nan_as_null` is DEPRECATED and has no effect. Please avoid using
    it; it will be removed in a future release.
allow_copy : bool, default True
    Whether to allow memory copying when exporting. If set to False
    it 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
     A
0    1
1    2

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


Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé