我有一个pandas数据帧,格式如下:
Timestamp Clientip
2015-07-22T02:40:06.499174Z 106.51.235.133
2015-07-22T02:40:06.632589Z 115.250.16.146
为了对上述数据进行会话化,我基于clientip对其进行分组,然后创建了一个sessionnumber字段。在
^{pr2}$当我运行第二个命令时,我得到错误“unsupported operand type for-:'unicode'and'unicode'”
不知道是什么让事情不对。任何帮助都将不胜感激。在
试试这个:
时间戳是ISO 8601格式的字符串,精度为微秒(应该用datetime.isoformat生成)。它们也是unicode格式(python3调用这些字符串),但只包含ASCII。使用适当的格式字符串,您可以用datetime.strptime解析它们。在Pandas中,适当的函数称为to_datetime。在
相关问题 更多 >
编程相关推荐