Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - speed - 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
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.geospatial.geodataframe.GeoDataFrame.speed = speed(self, index=None, begin_index=None, end_index=None)
DESCRIPTION:
    Returns the approximate speed at a specified point (speed(index
    INTEGER)) or between two points (speed(iBegin INTEGER, iEnd INTEGER))
    for a GeoSequence type.
    Notes:
        * If "begin_index" and "end_index" arguments are passed, then
          the speed is calculated as the distance between the two points
          (along the LineString) divided by the time between them.
        * If "index" is passed, then if the point is:
            * The first point, the distance between the first and second
              points is divided by the time between them.
            * The last point, the distance between the second to the last
              and last points is divided by the time between them.
            * Any other point, the distance between the previous point
              and the next point (along the LineString) is divided by the
              time difference between the previous point and the next point.
        * The units used for distance are the same units that are used by
          the coordinate system for the GeoSequence value, and the time
          units are in hours.
 
PARAMETERS:
    index:
        Optional Argument.
        Specifies the index of the point within the GeoSequence type,
        where the index of the first point is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
    begin_index:
        Optional Argument.
        Specifies the index of the starting point for which to
        calculate the speed, where the index of the first point in a
        GeoSequence type is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
    end_index:
        Optional Argument.
        Specifies the index of the ending point for which to calculate
        the speed, where the index of the first point in a GeoSequence is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
SUPPORTED GEOMETRY TYPES:
    GeoSequence
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrame
 
EXAMPLES:
    from teradataml import GeoDataFrame, load_example_data
    from teradataml import Point, LineString, Polygon
    # Load example data.
    load_example_data("geodataframe", "sample_shapes")
    # Create a GeoDataFrame.
    geodf = GeoDataFrame("sample_shapes")
    print(geodf)
    
    # Let's select only few columns from GeoDataFrame.
    geoseq = geodf.select(["skey", "geosequence"])[geodf.skey.isin([1001, 1002])]
 
    # Example 1: Get the approximate speed at a point specified at 1st index for Geosequence geometries.
    geoseq.speed(index=1)
 
    # Example 2: Get the approximate speed between points at 1st and 2nd index for Geosequence geometries.
    geoseq.speed(begin_index=1, end_index=2)