Teradata Package for Python Function Reference on VantageCloud Lake - least - 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 on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.least = least(self, *columns)
- DESCRIPTION:
Get the least values from the given columns.
Note:
* All of the input columns type must be of same data
type or else the types must be compatible.
PARAMETERS:
*columns:
Specifies the name(s) of the columns or ColumnExpression(s)
as positional arguments.
At least one positional argument is required.
Types: str or int or float or ColumnExpression OR ColumnExpressions
RETURNS:
ColumnExpression
EXAMPLES:
# Load the data to run the example.
>>> load_example_data("glmpredict", "housing_test")
>>>
# Create a DataFrame on 'housing_test' table.
>>> df = DataFrame("housing_test")
>>> df = df.select(["sn", "price", "lotsize", "bedrooms", "bathrms", "stories"])
>>> df
price lotsize bedrooms bathrms stories
sn
364 72000.0 10700.0 3 1 2
13 27000.0 1700.0 3 1 2
459 44555.0 2398.0 3 1 1
463 49000.0 2610.0 3 1 2
260 41000.0 6000.0 2 1 1
177 70000.0 5400.0 4 1 2
53 68000.0 9166.0 2 1 1
440 69000.0 6862.0 3 1 2
255 61000.0 4360.0 4 1 2
301 55000.0 4080.0 2 1 1
>>>
# Example 1: Find the least values in the columns "price" and "lotsize".
>>> lt_df = df.assign(lt_col=df.price.least(df.lotsize))
>>> lt_df
price lotsize bedrooms bathrms stories lt_col
sn
364 72000.0 10700.0 3 1 2 10700.0
13 27000.0 1700.0 3 1 2 1700.0
459 44555.0 2398.0 3 1 1 2398.0
463 49000.0 2610.0 3 1 2 2610.0
260 41000.0 6000.0 2 1 1 6000.0
177 70000.0 5400.0 4 1 2 5400.0
53 68000.0 9166.0 2 1 1 9166.0
440 69000.0 6862.0 3 1 2 6862.0
255 61000.0 4360.0 4 1 2 4360.0
301 55000.0 4080.0 2 1 1 4080.0
>>>
# Example 2: Find the least values in the columns "price", "lotsize" and 70000.0.
>>> lt_df = df.assign(lt_col=df.price.least(df.lotsize, 70000))
>>> lt_df
price lotsize bedrooms bathrms stories lt_col
sn
260 41000.0 6000.0 2 1 1 6000.0
38 67000.0 5170.0 3 1 4 5170.0
364 72000.0 10700.0 3 1 2 10700.0
301 55000.0 4080.0 2 1 1 4080.0
459 44555.0 2398.0 3 1 1 2398.0
177 70000.0 5400.0 4 1 2 5400.0
53 68000.0 9166.0 2 1 1 9166.0
440 69000.0 6862.0 3 1 2 6862.0
13 27000.0 1700.0 3 1 2 1700.0
469 55000.0 2176.0 2 1 2 2176.0
>>>