pyarrow.interchange.from_dataframe#
- pyarrow.interchange.from_dataframe(df: Any, allow_copy=True) Table [source]#
Build a
pa.Table
from any DataFrame supporting the interchange protocol.- Parameters:
- Returns:
pa.Table
Examples
>>> import pyarrow >>> from pyarrow.interchange import from_dataframe
Convert a pandas dataframe to a pyarrow table:
>>> import pandas as pd >>> df = pd.DataFrame({ ... "n_atendees": [100, 10, 1], ... "country": ["Italy", "Spain", "Slovenia"], ... }) >>> df n_atendees country 0 100 Italy 1 10 Spain 2 1 Slovenia >>> from_dataframe(df) pyarrow.Table n_atendees: int64 country: large_string ---- n_atendees: [[100,10,1]] country: [["Italy","Spain","Slovenia"]]