snowflake.snowpark.Session.range¶
- Session.range(start: int, end: Optional[int] = None, step: int = 1) DataFrame [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/session.py#L2591-L2627)¶
Creates a new DataFrame from a range of numbers. The resulting DataFrame has single column named
ID
, containing elements in a range fromstart
toend
(exclusive) with the step valuestep
.- Parameters:
start – The start of the range. If
end
is not specified,start
will be used as the value ofend
.end – The end of the range.
step – The step of the range.
Examples:
>>> session.range(10).collect() [Row(ID=0), Row(ID=1), Row(ID=2), Row(ID=3), Row(ID=4), Row(ID=5), Row(ID=6), Row(ID=7), Row(ID=8), Row(ID=9)] >>> session.range(1, 10).collect() [Row(ID=1), Row(ID=2), Row(ID=3), Row(ID=4), Row(ID=5), Row(ID=6), Row(ID=7), Row(ID=8), Row(ID=9)] >>> session.range(1, 10, 2).collect() [Row(ID=1), Row(ID=3), Row(ID=5), Row(ID=7), Row(ID=9)]