I have a dataframe that has connection date, disconnection date, rowID and RouterName. I want to find the current active connections in a while loop which iterates every minutes(this can be changed to any minutes) for 24 hours. I am trying to calculate the count of people in the location from this dataset which i will later use for calculating the agents risk level of being infected with corona or any airborne infectious disease. I cant find a way to calculate this from dataset using python pandas.
Find current active connections given connection and disconnection times of a location
180 Views Asked by selcuky At
1
I’m going to make a few assumptions:
every device Id is unique and there are no collisions
you are looking only for devices which are currently connected
a connected device has a null disconnect_at
active = df[df.disconnect_at < curr_timestamp] counts = active.groupby(“router_name”).agg({“device_id”:pd.Series.nunique})
Something like this should work