head() - Teradata Python Package

Teradata® Python Package User Guide

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-29
dita:mapPath
rkb1531260709148.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

Use the head() function to print the first n rows of a teradataml Series.

The function takes the optional argument n, and prints the first n number of rows. The default value for n is 10.

The Series object is sorted on the column. The column type must support sorting.

Unsupported types include: 'BLOB', 'CLOB', 'ARRAY', 'VARRAY'.

Example: Print default number of rows

This example prints the default 10 rows of Series "gpa":
>>> df = DataFrame("admissions_train")
>>> gpa = df.select(["gpa"]).squeeze()
>>> gpa.head()
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

Examples: Print n rows

The following example prints 5 rows of "gpa":
>>> gpa.head(5)
0    2.33
1    3.00
2    2.65
3    1.98
4    1.87
Name: gpa, dtype: float64
The following example prints 15 rows of "gpa":
>>> 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