@@ -87,22 +87,18 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se
87
87
88
88
intraday_features_to_compute = intraday_features_to_compute_steps + intraday_features_to_compute_sedentarybout + intraday_features_to_compute_activebout
89
89
90
+ # exclude rows when the total step count is ZERO during the whole day
91
+ if (not steps_intraday_data .empty ) and (not include_zero_step_rows ):
92
+ dailycountstep = steps_intraday_data .groupby (["local_date" ])[["steps" ]].sum ()
93
+ zerocountdates = dailycountstep [dailycountstep ["steps" ] == 0 ].index .tolist ()
94
+ steps_intraday_data = steps_intraday_data [~ steps_intraday_data ["local_date" ].isin (zerocountdates )]
95
+
90
96
# extract features from intraday features
91
97
steps_intraday_features = pd .DataFrame (columns = ["local_segment" ] + intraday_features_to_compute )
92
98
if not steps_intraday_data .empty :
93
99
steps_intraday_data = filter_data_by_segment (steps_intraday_data , time_segment )
94
100
95
101
if not steps_intraday_data .empty :
96
102
steps_intraday_features = extractStepsFeaturesFromIntradayData (steps_intraday_data , threshold_active_bout , intraday_features_to_compute_steps , intraday_features_to_compute_sedentarybout , intraday_features_to_compute_activebout , steps_intraday_features )
97
-
98
- # exclude rows when the total step count is ZERO during the whole day
99
- if not include_zero_step_rows :
100
- steps_intraday_features .index = steps_intraday_features ["local_segment" ].apply (lambda segment : segment .split ("#" )[1 ][:10 ])
101
-
102
- steps_intraday_features ["dailycountstep" ] = steps_intraday_data .groupby (["local_date" ])["steps" ].sum ()
103
- steps_intraday_features = steps_intraday_features .query ("dailycountstep != 0" )
104
-
105
- del steps_intraday_features ["dailycountstep" ]
106
- steps_intraday_features .reset_index (drop = True , inplace = True )
107
103
108
104
return steps_intraday_features
0 commit comments