Teradata Package for Python Function Reference | 20.00 - iloc - 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.geospatial.geodataframe.GeoDataFrame.iloc = iloc(self)
Access a group of rows and columns by integer values or a boolean array.
VALID INPUTS:
    - A single integer values, e.g. 5.
 
    - A list or array of integer values, e.g. ``[1, 2, 3]``.
 
    - A slice object with integer values, e.g. ``1:6``.
      Note: The stop value is excluded.
 
    - A boolean array of the same length as the column axis for column access,
 
    Note: For integer indexing on row access, the integer index values are
    applied to a sorted teradataml GeoDataFrame on the index column or the first column if
    there is no index column.
 
RETURNS:
    teradataml GeoDataFrame
 
RAISE:
    TeradataMlException
 
EXAMPLES
--------
    >>> load_example_data("geodataframe", ["sample_shapes"])
    >>> geo_dataframe = GeoDataFrame("sample_shapes")
    >>> geo_dataframe = geo_dataframe.select(['skey', 'points', 'linestrings'])
    >>> geo_dataframe
                                                                         points                                                                              linestrings
    skey
    1006                                           POINT (235.52 54.546 7.4564)                             LINESTRING (1.35 3.6456 4.5,3.6756 0.23 6.8,0.345 1.756 8.9)
    1007                                     MULTIPOINT (1 1,1 3,6 3,10 5,20 1)                                              MULTILINESTRING ((1 1,1 3,6 3),(10 5,20 1))
    1005                                                          POINT (1 3 5)                                                           LINESTRING (1 3 6,3 0 6,6 0 1)
    1004                                                       POINT (10 20 30)                                                  LINESTRING (10 20 30,40 50 60,70 80 80)
    1003                                                  POINT (235.52 54.546)                                         LINESTRING (1.35 3.6456,3.6756 0.23,0.345 1.756)
    1001                                                          POINT (10 20)                                                             LINESTRING (1 1,2 2,3 3,4 4)
    1002                                                            POINT (1 3)                                                                 LINESTRING (1 3,3 0,0 1)
    1009                                MULTIPOINT (10 20 30,40 50 60,70 80 80)                              MULTILINESTRING ((10 20 30,40 50 60),(70 80 80,90 100 110))
    1008       MULTIPOINT (1.65 1.76,1.23 3.76,6.23 3.78,10.76 5.9,20.32 1.231)                    MULTILINESTRING ((1 3,3 0,0 1),(1.35 3.6456,3.6756 0.23,0.345 1.756))
    1010  MULTIPOINT (10.345 20.32 30.6,40.234 50.23 60.24,70.234 80.56 80.234)  MULTILINESTRING ((1 3 6,3 0 6,6 0 1),(1.35 3.6456 4.5,3.6756 0.23 6.8,0.345 1.756 8.9))
 
    # Example 1: Slice a teradataml GeoDataFrame using a single integer.
    >>> geo_dataframe.iloc[1]
               points               linestrings
    skey
    1002  POINT (1 3)  LINESTRING (1 3,3 0,0 1)
 
    # Example 2: Slice a teradataml GeoDataFrame using list of integers. Note using ``[[]]``.
    >>> geo_dataframe.iloc[[1, 2]]
                         points                                       linestrings
    skey
    1003  POINT (235.52 54.546)  LINESTRING (1.35 3.6456,3.6756 0.23,0.345 1.756)
    1002            POINT (1 3)                          LINESTRING (1 3,3 0,0 1)
 
    # Example 3: Slice a teradataml GeoDataFrame using single integer for row and column.
    >>> geo_dataframe.iloc[5, 1]
                             points
    0  POINT (235.52 54.546 7.4564)
 
    # Example 4: Slice a teradataml GeoDataFrame using single integer for row and column access using a tuple.
    >>> geo_dataframe.iloc[(5, 1)]
                             points
    0  POINT (235.52 54.546 7.4564)
 
    # Example 5: Slice a teradataml GeoDataFrame using range for row and a single integer for column access.
    #            Note the stop for the range is excluded.
    >>> geo_dataframe.iloc[1:5, 2]
                                            linestrings
    0           LINESTRING (10 20 30,40 50 60,70 80 80)
    1                    LINESTRING (1 3 6,3 0 6,6 0 1)
    2  LINESTRING (1.35 3.6456,3.6756 0.23,0.345 1.756)
    3                          LINESTRING (1 3,3 0,0 1)
 
    # Example 6: Slice a teradataml GeoDataFrame using range for row and column access.
    #            Note the stop for the range is excluded.
    >>> geo_dataframe.iloc[1:5, 0:2]
                         points
    skey
    1004       POINT (10 20 30)
    1005          POINT (1 3 5)
    1003  POINT (235.52 54.546)
    1002            POINT (1 3)
 
    # Example 7: Slice a teradataml GeoDataFrame using empty range for row and column access.
    #            All rows and columns are retrieved.
    >>> geo_dataframe.iloc[:, :]
                                                                         points                                                                              linestrings
    skey
    1003                                                  POINT (235.52 54.546)                                         LINESTRING (1.35 3.6456,3.6756 0.23,0.345 1.756)
    1010  MULTIPOINT (10.345 20.32 30.6,40.234 50.23 60.24,70.234 80.56 80.234)  MULTILINESTRING ((1 3 6,3 0 6,6 0 1),(1.35 3.6456 4.5,3.6756 0.23 6.8,0.345 1.756 8.9))
    1008       MULTIPOINT (1.65 1.76,1.23 3.76,6.23 3.78,10.76 5.9,20.32 1.231)                    MULTILINESTRING ((1 3,3 0,0 1),(1.35 3.6456,3.6756 0.23,0.345 1.756))
    1006                                           POINT (235.52 54.546 7.4564)                             LINESTRING (1.35 3.6456 4.5,3.6756 0.23 6.8,0.345 1.756 8.9)
    1007                                     MULTIPOINT (1 1,1 3,6 3,10 5,20 1)                                              MULTILINESTRING ((1 1,1 3,6 3),(10 5,20 1))
    1005                                                          POINT (1 3 5)                                                           LINESTRING (1 3 6,3 0 6,6 0 1)
    1009                                MULTIPOINT (10 20 30,40 50 60,70 80 80)                              MULTILINESTRING ((10 20 30,40 50 60),(70 80 80,90 100 110))
    1001                                                          POINT (10 20)                                                             LINESTRING (1 1,2 2,3 3,4 4)
    1002                                                            POINT (1 3)                                                                 LINESTRING (1 3,3 0,0 1)
    1004                                                       POINT (10 20 30)                                                  LINESTRING (10 20 30,40 50 60,70 80 80)
 
    # Example 8: Slice a teradataml GeoDataFrame using list of integers and boolean array for column access.
    >>> geo_dataframe.iloc[[0, 1, 2], [True, False, True]]
                                               linestrings
    skey
    1003  LINESTRING (1.35 3.6456,3.6756 0.23,0.345 1.756)
    1002                          LINESTRING (1 3,3 0,0 1)
    1001                      LINESTRING (1 1,2 2,3 3,4 4)