head() | Series |Teradata Python Package teradataml - head() - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Publication Date
March 2025
Content Type
User Guide
Publication ID
B700-4006-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
ft:sourceId
dita
dita:id
rkb1531260709148
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