Teradata Package for Python Function Reference | 20.00 - head - 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
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00.00.11
Published
August 2026
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
teradataml.dataframe.dataframe.DataFrame.head = head(self, n=10, deterministic=False)
DESCRIPTION:
    Print the first n rows of the teradataml DataFrame.
 
PARAMETERS:
    n:
        Optional Argument.
        Specifies the number of rows to select.
        Note:
            - If 'deterministic' is False, 'n' should (0,100].
        Default Value: 10.
        Types: int
 
    deterministic:
        Optional Argument.
        Specifies whether to select the first n rows from the sorted DataFrame or not.
        Notes:
            * If True, the first n rows of the sorted DataFrame are selected.
              The DataFrame is sorted on the index column or the first column if
              there is no index column. The column type must support sorting.
              Unsupported types: ['BLOB', 'CLOB', 'ARRAY', 'VARRAY']
            * If False, a random sample of n rows is selected.
        Default Value: False.
        Types: bool
 
RETURNS:
    teradataml DataFrame
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    >>> load_example_data("dataframe","admissions_train")
    >>> df = DataFrame.from_table('admissions_train')
    >>> df
       masters   gpa     stats programming admitted
    id
    15     yes  4.00  Advanced    Advanced        1
    7      yes  2.33    Novice      Novice        1
    22     yes  3.46    Novice    Beginner        0
    17      no  3.83  Advanced    Advanced        1
    13      no  4.00  Advanced      Novice        1
    38     yes  2.65  Advanced    Beginner        1
    26     yes  3.57  Advanced    Advanced        1
    5       no  3.44    Novice      Novice        0
    34     yes  3.85  Advanced    Beginner        0
    40     yes  3.95    Novice    Beginner        0
    
    >>> df.head()
       masters   gpa     stats programming admitted
    id
    3       no  3.70    Novice    Beginner        1
    5       no  3.44    Novice      Novice        0
    6      yes  3.50  Beginner    Advanced        1
    7      yes  2.33    Novice      Novice        1
    9       no  3.82  Advanced    Advanced        1
    10      no  3.71  Advanced    Advanced        1
    8       no  3.60  Beginner    Advanced        1
    4      yes  3.50  Beginner      Novice        1
    2      yes  3.76  Beginner    Beginner        0
    1      yes  3.95  Beginner    Beginner        0
    
    >>> df.head(15, deterministic=True)
       masters   gpa     stats programming admitted
    id
    3       no  3.70    Novice    Beginner        1
    5       no  3.44    Novice      Novice        0
    6      yes  3.50  Beginner    Advanced        1
    7      yes  2.33    Novice      Novice        1
    9       no  3.82  Advanced    Advanced        1
    10      no  3.71  Advanced    Advanced        1
    11      no  3.13  Advanced    Advanced        1
    12      no  3.65    Novice      Novice        1
    13      no  4.00  Advanced      Novice        1
    14     yes  3.45  Advanced    Advanced        0
    15     yes  4.00  Advanced    Advanced        1
    8       no  3.60  Beginner    Advanced        1
    4      yes  3.50  Beginner      Novice        1
    2      yes  3.76  Beginner    Beginner        0
    1      yes  3.95  Beginner    Beginner        0
    
    >>> df.head(5, deterministic=True)
       masters   gpa     stats programming admitted
    id
    3       no  3.70    Novice    Beginner        1
    5       no  3.44    Novice      Novice        0
    4      yes  3.50  Beginner      Novice        1
    2      yes  3.76  Beginner    Beginner        0
    1      yes  3.95  Beginner    Beginner        0
 
    >>> df.head(3, deterministic=False)
      masters   gpa     stats programming  admitted
    id                                              
    40     yes  3.95    Novice    Beginner         0
    19     yes  1.98  Advanced    Advanced         0
    38     yes  2.65  Advanced    Beginner         1