python - How to calculate the max click interval using pandas? -


i have dataset indicates when ip click link:

ip time

i want calculate maximum click interval of every different ip.

is there anyway this?

if understand question, you're looking following.

import pandas pd  df = pd.dataframe({'ip':[1,1,1,1,1,2,2,2,2],                    'time':pd.date_range('01-15-16 12:00:00',                    periods=9)}) df_grp = df.groupby('ip')['time'].apply(lambda x: x.max() - x.min()) 

this calculates time difference between first , last clicks associated ip.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -