Teradata Package for Python Function Reference | 20.00 - greatest - 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
- Enterprise
- IntelliFlex
- VMware
- 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_Enterprise_2000
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.greatest = greatest(self, *columns)
- DESCRIPTION:
Get the greatest 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 greatest values in the columns "price" and "lotsize".
>>> gt_df = df.assign(gt_col=df.price.greatest(df.lotsize))
>>> gt_df
price lotsize bedrooms bathrms stories gt_col
sn
364 72000.0 10700.0 3 1 2 72000.0
13 27000.0 1700.0 3 1 2 27000.0
459 44555.0 2398.0 3 1 1 44555.0
463 49000.0 2610.0 3 1 2 49000.0
260 41000.0 6000.0 2 1 1 41000.0
177 70000.0 5400.0 4 1 2 70000.0
53 68000.0 9166.0 2 1 1 68000.0
440 69000.0 6862.0 3 1 2 69000.0
255 61000.0 4360.0 4 1 2 61000.0
301 55000.0 4080.0 2 1 1 55000.0
>>>
# Example 2: Find the greatest values in the columns "price", "lotsize" and 70000.0.
>>> gt_df = df.assign(gt_col=df.price.greatest(df.lotsize, 70000))
>>> gt_df
price lotsize bedrooms bathrms stories gt_col
sn
364 72000.0 10700.0 3 1 2 72000.0
13 27000.0 1700.0 3 1 2 70000.0
459 44555.0 2398.0 3 1 1 70000.0
463 49000.0 2610.0 3 1 2 70000.0
260 41000.0 6000.0 2 1 1 70000.0
177 70000.0 5400.0 4 1 2 70000.0
53 68000.0 9166.0 2 1 1 70000.0
440 69000.0 6862.0 3 1 2 70000.0
255 61000.0 4360.0 4 1 2 70000.0
301 55000.0 4080.0 2 1 1 70000.0
>>>