Teradata Package for Python Function Reference on VantageCloud Lake - notna - 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.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.notna = notna(self)
- 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")
# Test for NA values on dataframe by using 0 and 1.
>>> df[df.gpa.notna() == 1]
masters gpa stats programming admitted
id
22 yes 3.46 Novice Beginner 0
36 no 3.00 Advanced Novice 0
15 yes 4.00 Advanced Advanced 1
38 yes 2.65 Advanced Beginner 1
5 no 3.44 Novice Novice 0
17 no 3.83 Advanced Advanced 1
34 yes 3.85 Advanced Beginner 0
13 no 4.00 Advanced Novice 1
26 yes 3.57 Advanced Advanced 1
19 yes 1.98 Advanced Advanced 0
>>> df[df.gpa.notna() == 0]
Empty DataFrame
Columns: [masters, gpa, stats, programming, admitted]
Index: []
# Test for NA values on dataframe by using False and True.
>>> df[df.gpa.notna() == True]
masters gpa stats programming admitted
id
22 yes 3.46 Novice Beginner 0
36 no 3.00 Advanced Novice 0
15 yes 4.00 Advanced Advanced 1
38 yes 2.65 Advanced Beginner 1
5 no 3.44 Novice Novice 0
17 no 3.83 Advanced Advanced 1
34 yes 3.85 Advanced Beginner 0
13 no 4.00 Advanced Novice 1
26 yes 3.57 Advanced Advanced 1
19 yes 1.98 Advanced Advanced 0
>>> df[df.gpa.notna() == False]
Empty DataFrame
Columns: [masters, gpa, stats, programming, admitted]
Index: []
# Assign the tested values to dataframe as a column.
>>> df.assign(notna_=df.gpa.notna())
masters gpa stats programming admitted notna_
id
22 yes 3.46 Novice Beginner 0 1
36 no 3.00 Advanced Novice 0 1
15 yes 4.00 Advanced Advanced 1 1
38 yes 2.65 Advanced Beginner 1 1
5 no 3.44 Novice Novice 0 1
17 no 3.83 Advanced Advanced 1 1
34 yes 3.85 Advanced Beginner 0 1
13 no 4.00 Advanced Novice 1 1
26 yes 3.57 Advanced Advanced 1 1
19 yes 1.98 Advanced Advanced 0 1