Teradata Package for Python Function Reference | 20.00 - td_range - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- VMware
- Enterprise
- IntelliFlex
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.11
- Publication Date
- August 2026
- Content Type
- Programming Reference
- Publication ID
- B700-4008-200K
- ft:locale
- en-US
- ft:lastEdition
- 2026-08-13
- ft:sourceId
- FTML
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.functions.td_range = td_range(start, end=None, step=1)
- DESCRIPTION:
Creates a DataFrame with a specified range of numbers.
Notes:
1. The range is inclusive of the start and exclusive of the end.
2. If only start is provided, then end is set to start and start is set to 0.
PARAMETERS:
start:
Required Argument.
Specifies the starting number of the range.
Types: int
end:
Optional Argument.
Specifies the end number of the range(exclusive).
Default Value: None
Types: int
step:
Optional Argument.
Specifies the step size of the range.
Default Value: 1
Types: int
RETURNS:
teradataml DataFrame
RAISES:
TeradataMlException
EXAMPLES:
# Example 1: Create a DataFrame with a range of numbers from 0 to 5.
>>> from teradataml.dataframe.functions import td_range
>>> df = td_range(5)
>>> df.sort('id')
id
0 0
1 1
2 2
3 3
4 4
# Example 2: Create a DataFrame with a range of numbers from 5 to 1 with step size of -2.
>>> from teradataml.dataframe.functions import td_range
>>> td_range(5, 1, -2)
id
0 3
1 5
>>> Example 3: Create a DataFrame with a range of numbers from 1 to 5 with default step size of 1.
>>> from teradataml.dataframe.functions import td_range
>>> td_range(1, 5)
id
0 3
1 4
2 2
3 1