pyspark.sql.functions.timestamp_seconds¶
-
pyspark.sql.functions。
timestamp_seconds
( 上校:ColumnOrName )→pyspark.sql.column.Column¶ -
轉換從Unix新紀元的秒數(1970 - 01 - 01 - t00:00:00z)到一個時間戳。
例子
> > >從pyspark.sql.functions進口timestamp_seconds> > >火花。相依。集(“spark.sql.session.timeZone”,“UTC”)> > >time_df=火花。createDataFrame(((1230219000),(“unix_time”])> > >time_df。選擇(timestamp_seconds(time_df。unix_time)。別名(“t”))。顯示()+ - - - - - - - - - - - - - - - - - - - +| ts |+ - - - - - - - - - - - - - - - - - - - +| 2008-12-25 15:30:00 |+ - - - - - - - - - - - - - - - - - - - +> > >time_df。選擇(timestamp_seconds(“unix_time”)。別名(“t”))。printSchema()根| - ts:時間戳(nullable = true)> > >火花。相依。設置(“spark.sql.session.timeZone”)