snowflake.snowpark.DataFrame.limit¶
- DataFrame.limit(n: int, offset: int = 0) DataFrame [source]¶
Returns a new DataFrame that contains at most
n
rows from the current DataFrame, skippingoffset
rows from the beginning (similar to LIMIT and OFFSET in SQL).Note that this is a transformation method and not an action method.
- Parameters:
n – Number of rows to return.
offset – Number of rows to skip before the start of the result set. The default value is 0.
_ast_stmt – Overridding AST statement. Used in cases where this function is invoked internally.
_emit_ast – Whether to emit AST statements.
Example:
>>> df = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"]) >>> df.limit(1).show() ------------- |"A" |"B" | ------------- |1 |2 | ------------- >>> df.limit(1, offset=1).show() ------------- |"A" |"B" | ------------- |3 |4 | -------------