snowflake.snowpark.DataFrame.toPandas¶
- DataFrame.toPandas(*, statement_params: Optional[Dict[str, str]] = None, block: bool = True, **kwargs: Dict[str, Any]) Union[DataFrame, AsyncJob] [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/dataframe.py#L948-L1015)¶
Executes the query representing this DataFrame and returns the result as a pandas DataFrame (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html).
When the data is too large to fit into memory, you can use
to_pandas_batches()
.- Parameters:
statement_params – Dictionary of statement level parameters to be set while executing this action.
block – A bool value indicating whether this function will wait until the result is available. When it is
False
, this function executes the underlying queries of the dataframe asynchronously and returns anAsyncJob
.
Note
This method is only available if pandas is installed and available.
2. If you use
Session.sql()
with this method, the input query ofSession.sql()
can only be a SELECT statement.3. For TIMESTAMP columns: - TIMESTAMP_LTZ and TIMESTAMP_TZ are both converted to datetime64[ns, tz] in pandas, as pandas cannot distinguish between the two. - TIMESTAMP_NTZ is converted to datetime64[ns] (without timezone).