Teradata Package for Python Function Reference on VantageCloud Lake - hypot - 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.hypot = hypot(self, other)
- DESCRIPTION:
Function to compute the hypotenuse.
PARAMETERS:
other:
Required Argument.
Specifies DataFrame column for calculation of hypotenuse.
Types: int or float or str or ColumnExpression
Returns:
ColumnExpression
Examples:
# Load the data to run the example.
>>> load_example_data("teradataml","titanic")
# Create a DataFrame on 'titanic' table.
>>> titanic = DataFrame.from_table('titanic')
>>> df = titanic.select(["passenger", "age", "fare"])
>>> print(df)
age fare
passenger
326 36.0 135.6333
183 9.0 31.3875
652 18.0 23.0000
265 NaN 7.7500
530 23.0 11.5000
122 NaN 8.0500
591 35.0 7.1250
387 1.0 46.9000
734 23.0 13.0000
795 25.0 7.8958
>>>
# Example 1: compute hypotenuse of two columns fare and age.
>>> hypot_df = df.assign(hypot_column=df.fare.hypot(titanic.age))
>>> print(hypot_df)
age fare hypot_column
passenger
326 36.0 135.6333 140.329584
183 9.0 31.3875 32.652338
652 18.0 23.0000 29.206164
40 14.0 11.2417 17.954827
774 NaN 7.2250 NaN
366 30.0 7.2500 30.863611
509 28.0 22.5250 35.935715
795 25.0 7.8958 26.217240
61 22.0 7.2292 23.157317
469 NaN 7.7250 NaN
>>>