Teradata Package for Python Function Reference - 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

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage
teradataml.series.series.Series.head = head(self, n=10)
Print the first n rows of the sorted teradataml Series.
Note: The Series is sorted on the column composing the Series object.
The column type must support sorting.
Unsupported types: ['BLOB', 'CLOB', 'ARRAY', 'VARRAY']
 
PARAMETERS:
    n:
        Optional argument.
        Specifies the number of rows to select.
        Default Value: 10.
        Type: int
 
RETURNS:
    teradataml Series
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    >>> load_example_data("dataframe", "admissions_train")
    >>> df = DataFrame("admissions_train")
    >>> df
       masters   gpa     stats programming admitted
    id
    22     yes  3.46    Novice    Beginner        0
    36      no  3.00  Advanced      Novice        0
    15     yes  4.00  Advanced    Advanced        1
    38     yes  2.65  Advanced    Beginner        1
    5       no  3.44    Novice      Novice        0
    17      no  3.83  Advanced    Advanced        1
    34     yes  3.85  Advanced    Beginner        0
    13      no  4.00  Advanced      Novice        1
    26     yes  3.57  Advanced    Advanced        1
    19     yes  1.98  Advanced    Advanced        0
 
    >>> gpa = df.select(["gpa"]).squeeze()
    >>> gpa
    0    4.00
    1    2.33
    2    3.46
    3    3.83
    4    4.00
    5    2.65
    6    3.57
    7    3.44
    8    3.85
    9    3.95
    Name: gpa, dtype: float64
 
    >>> gpa.head()
    0    2.33
    1    3.00
    2    3.13
    3    3.44
    4    3.46
    5    3.46
    6    3.45
    7    2.65
    8    1.98
    9    1.87
    Name: gpa, dtype: float64
 
    >>> gpa.head(15)
    0     2.33
    1     3.00
    2     3.13
    3     3.44
    4     3.46
    5     3.46
    6     3.50
    7     3.50
    8     3.50
    9     3.52
    10    3.55
    11    3.45
    12    2.65
    13    1.98
    14    1.87
    Name: gpa, dtype: float64
 
    >>> gpa.head(5)
    0    2.33
    1    3.00
    2    2.65
    3    1.98
    4    1.87
    Name: gpa, dtype: float64