Teradata Package for Python Function Reference on VantageCloud Lake - hour - 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.11
Publication Date
August 2026
Content Type
Programming Reference
Publication ID
B700-4500-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.dataframe.sql.DataFrameColumn.hour = hour()
DESCRIPTION:
    Function returns the number of weeks from the beginning of the year to the specified date or timestamp value in
    a column as a literal.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    DataFrameColumn
 
EXAMPLES:
    # Load the data to run the example.
    >>> load_example_data("dataframe", ["ocean_buoys"])
 
    # Create a DataFrame on 'ocean_buoys' table.
    >>> ocean_df = DataFrame.from_table('ocean_buoys')
 
    # Example 1: Returns the integer value for hour in the specified timestamp value in a column as a literal.
    >>> res_df = ocean_df.assign(res = ocean_df.TD_TIMECODE.hour())
    >>> print(res_df)
                           TD_TIMECODE  salinity  temperature  res
    buoyid
    0       2014-01-06 08:09:59.999999        55           99    8
    0       2014-01-06 08:10:00.000000        55          100    8
    44      2014-01-06 10:00:24.000000        55           43   10
    1       2014-01-06 09:01:25.122200        55           77    9
    1       2014-01-06 09:02:25.122200        55           78    9
    1       2014-01-06 09:02:25.122200        55           71    9
    1       2014-01-06 09:03:25.122200        55           79    9
    1       2014-01-06 09:03:25.122200        55           72    9
    1       2014-01-06 09:01:25.122200        55           70    9
    0       2014-01-06 08:10:00.000000        55           10    8