如何在Pyspark的间隔日到第二次提取纳秒?
def calculate_session_duration(df):
newDf = df.groupBy("SessionId").agg((F.max("TimeGenerated") - F.min("TimeGenerated")).alias("TimeRange"))
return df2
大家好,我在Pyspark中具有以下功能,时间戳之间的减法使我返回“间隔日至秒”数据类型。 我试图弄清楚如何从“时间范围”列中提取纳秒秒,这就是这样: 在这里输入图像描述
您有任何建议吗?
谢谢。
def calculate_session_duration(df):
newDf = df.groupBy("SessionId").agg((F.max("TimeGenerated") - F.min("TimeGenerated")).alias("TimeRange"))
return df2
Hi guys, i have the following function in PySpark, the subtraction between timestamp returns me an "interval day to seconds" data type.
I'm trying to figure it out how to extract the nanoseconds from the column "Time Range" that is something like this:
enter image description here
Do you have any suggestion?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下操作:
输出将是这样的:
浮点之后的值是第二部分。
Try this:
The output will be something like this:
and values after the floating point are fractions of second.