I have a dataframe in which one of the column is a time stamp.
How can i create another data frame from this column in the below format
Can i get some help here please?
Let's say your timestamp column name is time:
from pyspark.sql.functions import *
df2 = df1.withColumn('year',year('time')).withColumn('quarter',quarter('time')).withColumn('weekOfTheYear',weekofyear('time')).withColumn('dayOfTheWeek', dayofweek('time')).withColumn('dayofmonth',dayofmonth('time'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.