fillna and na.fill | teradatamlspk | pyspark2teradataml - fillna and na.fill - Teradata Package for Python

Teradata® pyspark2teradataml User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-11
dita:mapPath
oeg1710443196055.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
oeg1710443196055
Product Category
Teradata Vantage

When using fillna or na.fill in teradatamlspk, all input arguments must be of the same data type or their types must be compatible.

For example, if value is a integer type, and subset contains a string column, PySpark ignores the replacement but, teradatamlspk raises an error. You must drop incompatible columns or cast them to the compatible ones.

PySpark

>>> df.fillna(12).show()
+----------+-----+---+---+---+
|  accounts|  Feb|Jan|Mar|Apr|
+----------+-----+---+---+---+
|   Red Inc|200.0|150|140| 12|
|      NULL| 12.0| 12| 12|250|
|  Blue Inc| 90.0| 50| 95|101|
|      NULL| 12.0|200|215|250|
|Yellow Inc| 90.0| 12| 12| 12|
| Jones LLC|200.0|150|140|180|
+----------+-----+---+---+---+

teradatamlspk

>>> df.drop("accounts").fillna(12).show()
+-----+-----+-----+-----+
|  Feb|  Jan|  Mar|  Apr|
+-----+-----+-----+-----+
| 90.0| 50.0| 95.0|101.0|
| 90.0| 12.0| 12.0| 12.0|
|200.0|150.0|140.0|180.0|
| 12.0|200.0|215.0|250.0|
| 12.0| 12.0| 12.0|250.0|
|200.0|150.0|140.0| 12.0|
+-----+-----+-----+-----+