Example Setup | Time Series Aggregates Functions | Teradata Python Package - Example Setup - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Examples for Time Series Aggregates functions share same steps to set up the environment.

The following lists the procedure to load the example datasets and create required DataFrames to prepare for the examples of Time Series Aggregate functions.

  • Load the example datasets
    >>> load_example_data("dataframe", ["ocean_buoys", "ocean_buoys_seq", "ocean_buoys_nonpti"])
  • Create required DataFrames:
    • DataFrame on non-sequenced PTI table
      >>> ocean_buoys = DataFrame("ocean_buoys")

      Check the DataFrame columns:

      >>>ocean_buoys.columns
      ['buoyid', 'TD_TIMECODE', 'temperature', 'salinity']

      Check the head of the DataFrame:

      >>> ocean_buoys.head()
                             TD_TIMECODE  temperature  salinity
      buoyid
      0       2014-01-06 08:10:00.000000        100.0        55
      0       2014-01-06 08:08:59.999999          NaN        55
      1       2014-01-06 09:01:25.122200         77.0        55
      1       2014-01-06 09:03:25.122200         79.0        55
      1       2014-01-06 09:01:25.122200         70.0        55
      1       2014-01-06 09:02:25.122200         71.0        55
      1       2014-01-06 09:03:25.122200         72.0        55
      0       2014-01-06 08:09:59.999999         99.0        55
      0       2014-01-06 08:00:00.000000         10.0        55
      0       2014-01-06 08:10:00.000000         10.0        55
    • DataFrame on sequenced PTI table
      >>> ocean_buoys_seq = DataFrame("ocean_buoys_seq")

      Check the DataFrame columns:

      >>> ocean_buoys_seq.columns
      ['TD_TIMECODE', 'TD_SEQNO', 'buoyid', 'salinity', 'temperature', 'dates']

      Check the head of the DataFrame:

      >>> ocean_buoys_seq.head()
                             TD_TIMECODE  TD_SEQNO  salinity  temperature       dates
      buoyid
      0       2014-01-06 08:00:00.000000        26        55         10.0  2016-02-26
      0       2014-01-06 08:08:59.999999        18        55          NaN  2015-06-18
      1       2014-01-06 09:02:25.122200        24        55         78.0  2015-12-24
      1       2014-01-06 09:01:25.122200        23        55         77.0  2015-11-23
      1       2014-01-06 09:02:25.122200        12        55         71.0  2014-12-12
      1       2014-01-06 09:03:25.122200        13        55         72.0  2015-01-13
      1       2014-01-06 09:01:25.122200        11        55         70.0  2014-11-11
      0       2014-01-06 08:10:00.000000        19        55         10.0  2015-07-19
      0       2014-01-06 08:09:59.999999        17        55         99.0  2015-05-17
      0       2014-01-06 08:10:00.000000        27        55        100.0  2016-03-27
    • DataFrame on non-PTI table
      >>> ocean_buoys_nonpti = DataFrame("ocean_buoys_nonpti")

      Check the DataFrame columns:

      >>> ocean_buoys_nonpti.columns
      ['buoyid', 'timecode', 'temperature', 'salinity']

      Check the head of the DataFrame:

      >>> ocean_buoys_nonpti.head()
                                  buoyid  temperature  salinity
      timecode
      2014-01-06 08:09:59.999999       0         99.0        55
      2014-01-06 08:10:00.000000       0         10.0        55
      2014-01-06 09:01:25.122200       1         70.0        55
      2014-01-06 09:01:25.122200       1         77.0        55
      2014-01-06 09:02:25.122200       1         71.0        55
      2014-01-06 09:03:25.122200       1         72.0        55
      2014-01-06 09:02:25.122200       1         78.0        55
      2014-01-06 08:10:00.000000       0        100.0        55
      2014-01-06 08:08:59.999999       0          NaN        55
      2014-01-06 08:00:00.000000       0         10.0        55