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

snowflake.snowpark.Session.range

Session.range(start: int, end: int | None = None, step: int = 1) DataFrame[source]

Creates a new DataFrame from a range of numbers. The resulting DataFrame has single column named ID, containing elements in a range from start to end (exclusive) with the step value step.

Parameters:
  • start – The start of the range. If end is not specified, start will be used as the value of end.

  • 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)]
Copy