Teradata Package for Python Function Reference on VantageCloud Lake - 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 on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.02
- Published
- September 2024
- Language
- English (United States)
- Last Update
- 2024-10-17
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.dataframe.DataFrame.head = head(self, n=10)
- DESCRIPTION:
Print the first n rows of the sorted teradataml DataFrame.
Note: 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']
PARAMETERS:
n:
Optional Argument.
Specifies the number of rows to select.
Default Value: 10.
Types: int
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)
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)
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