You are viewing documentation about an older version (1.4.0). View latest version

snowflake.snowpark.DataFrame.first¶

DataFrame.first(n: int | None = None, *, statement_params: Dict[str, str] | None = None, block: bool = True) → Row | None | List[Row][source]¶
DataFrame.first(n: int | None = None, *, statement_params: Dict[str, str] | None = None, block: bool = False) → AsyncJob

Executes the query representing this DataFrame and returns the first n rows of the results.

Parameters:
  • n – The number of rows to return.

  • 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 an AsyncJob.

Returns:

A list of the first n Row objects if n is not None. If n is negative or larger than the number of rows in the result, returns all rows in the results. n is None, it returns the first Row of results, or None if it does not exist.