Teradata Package for Python Function Reference | 17.10 - tail - Teradata Package for Python
Teradata® Package for Python Function Reference
- Product
- Teradata Package for Python
- Release Number
- 17.10
- Published
- April 2022
- Language
- English (United States)
- Last Update
- 2022-08-19
- Product Category
- Teradata Vantage
- teradataml.dataframe.dataframe.DataFrame.tail = tail(self, n=10)
- DESCRIPTION:
Print the last 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.tail()
masters gpa stats programming admitted
id
38 yes 2.65 Advanced Beginner 1
36 no 3.00 Advanced Novice 0
35 no 3.68 Novice Beginner 1
34 yes 3.85 Advanced Beginner 0
32 yes 3.46 Advanced Beginner 0
31 yes 3.50 Advanced Beginner 1
33 no 3.55 Novice Novice 1
37 no 3.52 Novice Novice 1
39 yes 3.75 Advanced Beginner 0
40 yes 3.95 Novice Beginner 0
>>> df.tail(3)
masters gpa stats programming admitted
id
38 yes 2.65 Advanced Beginner 1
39 yes 3.75 Advanced Beginner 0
40 yes 3.95 Novice Beginner 0
>>> df.tail(15)
masters gpa stats programming admitted
id
38 yes 2.65 Advanced Beginner 1
36 no 3.00 Advanced Novice 0
35 no 3.68 Novice Beginner 1
34 yes 3.85 Advanced Beginner 0
32 yes 3.46 Advanced Beginner 0
31 yes 3.50 Advanced Beginner 1
30 yes 3.79 Advanced Novice 0
29 yes 4.00 Novice Beginner 0
28 no 3.93 Advanced Advanced 1
27 yes 3.96 Advanced Advanced 0
26 yes 3.57 Advanced Advanced 1
33 no 3.55 Novice Novice 1
37 no 3.52 Novice Novice 1
39 yes 3.75 Advanced Beginner 0
40 yes 3.95 Novice Beginner 0