Teradata Package for Python Function Reference | 20.00 - notnull - 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 - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- Enterprise
- IntelliFlex
- VMware
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.notnull = notnull(self)
- Alias for notna().Test for non NA values
The boolean complement of isna()
PARAMETERS:
None
RETURNS:
When used with assign() function, newly assigned column contains
A boolean Series of numeric values:
- 1 if value is NA (None)
- 0 if values is not NA
Otherwise returns ColumnExpression, also known as, teradataml DataFrameColumn.
EXAMPLES:
>>> load_example_data("dataframe", "admissions_train")
>>> df = DataFrame("admissions_train")
>>> df[df.gpa.notnull() == 1]
masters gpa stats programming admitted
id
5 no 3.44 Novice Novice 0
34 yes 3.85 Advanced Beginner 0
13 no 4.00 Advanced Novice 1
40 yes 3.95 Novice Beginner 0
22 yes 3.46 Novice Beginner 0
19 yes 1.98 Advanced Advanced 0
36 no 3.00 Advanced Novice 0
15 yes 4.00 Advanced Advanced 1
7 yes 2.33 Novice Novice 1
17 no 3.83 Advanced Advanced 1
>>> df[df.gpa.notnull() == 0]
Empty DataFrame
Columns: [masters, gpa, stats, programming, admitted]
Index: []
# alternatively, True and False can be used
>>> df[df.gpa.notnull() == True]
masters gpa stats programming admitted
id
22 yes 3.46 Novice Beginner 0
26 yes 3.57 Advanced Advanced 1
5 no 3.44 Novice Novice 0
17 no 3.83 Advanced Advanced 1
13 no 4.00 Advanced Novice 1
19 yes 1.98 Advanced Advanced 0
36 no 3.00 Advanced Novice 0
15 yes 4.00 Advanced Advanced 1
34 yes 3.85 Advanced Beginner 0
38 yes 2.65 Advanced Beginner 1
>>> df[df.gpa.notnull() == False]
Empty DataFrame
Columns: [masters, gpa, stats, programming, admitted]
Index: []
# Assign the tested values to dataframe as a column.
>>> df.assign(notnull_=df.gpa.notnull())
masters gpa stats programming admitted notnull_
id
22 yes 3.46 Novice Beginner 0 1
26 yes 3.57 Advanced Advanced 1 1
5 no 3.44 Novice Novice 0 1
17 no 3.83 Advanced Advanced 1 1
13 no 4.00 Advanced Novice 1 1
19 yes 1.98 Advanced Advanced 0 1
36 no 3.00 Advanced Novice 0 1
15 yes 4.00 Advanced Advanced 1 1
34 yes 3.85 Advanced Beginner 0 1
38 yes 2.65 Advanced Beginner 1 1