Modified the UNIX time to minutes from Midnight in timeFirstConversation and timeLastConversation

pull/95/head
nikunjgoel95 2020-06-21 16:49:29 -04:00
parent fa9d047eb1
commit 78a9d82a74
1 changed files with 11 additions and 3 deletions

View File

@ -78,11 +78,19 @@ def base_conversation_features(conversation_data, day_segment, requested_feature
conversation_features["conversation_" + day_segment + "_maxconversationduration"] = conversation_data.groupby(["local_date"])['conv_Dur'].max()
if "timefirstconversation" in features_to_compute:
conversation_features["conversation_" + day_segment + "_timefirstconversation"] = conversation_data[conversation_data["double_convo_start"]> 0].groupby(["local_date"])['double_convo_start'].min()
timeFirstConversation = conversation_data[conversation_data["double_convo_start"]> 0].groupby(["local_date"])[['double_convo_start','local_hour','local_minute']].min()
if 'local_hour' in timeFirstConversation.columns:
conversation_features["conversation_" + day_segment + "_timefirstconversation"] = timeFirstConversation["local_hour"]*60 + timeFirstConversation["local_minute"]
else:
conversation_features["conversation_" + day_segment + "_timefirstconversation"] = 0
if "timelastconversation" in features_to_compute:
conversation_features["conversation_" + day_segment + "_timelastconversation"] = conversation_data.groupby(["local_date"])['double_convo_start'].max()
timeLastConversation = conversation_data[conversation_data["double_convo_start"] > 0].groupby(["local_date"])[['double_convo_start','local_hour','local_minute']].max()
if 'local_hour' in timeLastConversation:
conversation_features["conversation_" + day_segment + "_timelastconversation"] = timeLastConversation["local_hour"]*60 + timeLastConversation["local_minute"]
else:
conversation_features["conversation_" + day_segment + "_timelastconversation"] = 0
if "sumenergy" in features_to_compute:
conversation_features["conversation_" + day_segment + "_sumenergy"] = conversation_data.groupby(["local_date"])['double_energy'].sum()