Horje
spark get year from date Code Example
spark get year from date
import datetime
from pyspark.sql.functions import year, month, dayofmonth

elevDF = sc.parallelize([
    (datetime.datetime(1984, 1, 1, 0, 0), 1, 638.55),
    (datetime.datetime(1984, 1, 1, 0, 0), 2, 638.55),
    (datetime.datetime(1984, 1, 1, 0, 0), 3, 638.55),
    (datetime.datetime(1984, 1, 1, 0, 0), 4, 638.55),
    (datetime.datetime(1984, 1, 1, 0, 0), 5, 638.55)
]).toDF(["date", "hour", "value"])

elevDF.select(
    year("date").alias('year'), 
    month("date").alias('month'), 
    dayofmonth("date").alias('day')
).show()




Whatever

Related
can you create a proxy serer on windoes xp Code Example can you create a proxy serer on windoes xp Code Example
int and const Code Example int and const Code Example
tile palette background color Code Example tile palette background color Code Example
db.collection.deleteMany( Code Example db.collection.deleteMany( Code Example
how to run program with other files in gdb Code Example how to run program with other files in gdb Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7