我有122864行数据。我在HDF5文件中存储数据。利用熊猫进行数据处理。对于记录中的每个唯一id,都有一个关联的时间戳,指示用户打开应用程序的时间。我想得到两次点击应用程序之间的平均持续时间。在1283 2015-04-01 08:07:44.131768
1284 2015-04-01 08:08:02.752611
1285 2015-04-01 08:08:02.793380
1286 2015-04-01 08:07:53.910469
1287 2015-04-01 08:08:03.305893
1288 2015-04-01 08:07:44.843050
1289 2015-04-01 08:07:54.767203
1290 2015-04-01 08:08:03.965367
1291 2015-04-01 08:07:45.924854
1292 2015-04-01 08:07:55.408593
1293 2015-04-01 08:07:46.365128
class User(object):
'''
Properties and function related to each object.
attributes:
datetime: a list of hit timestamp for each user object
deviceid: unique deviceid
'''
def __init__(self, User, device_id):
self.datetime = pd.to_datetime(list(User['datetime']))
self.deviceid = devi