How to fill none values with a concrete timestamp in DataFrame?

Viewed 4429

I use Spark 2.1 and python 2.7.12.

Suppose the following:

from pyspark.sql.functions import *
import timestamp

data = [Row(time=datetime.datetime(2017, 1, 1, 0, 0, 0, 0)), Row (time=datetime.datetime(1980, 1, 1, 0, 0, 0, 0)), Row(time=None) ]

df = spark.createDataFrame(data)

How to use df.fillna({'time': datetime.datetime(1980, 1, 1, 0, 0, 0, 0)}) to fill in the null value/s with a specific time?

1 Answers
Related