Skip to content

Commit fe36592

Browse files
authored
Merge pull request #713 from ibm-watson-iot/kohlmann-master-groupkey
[patch] add group key to result df
2 parents 386ed77 + 3d4ba9f commit fe36592

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iotfunctions/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,9 +2711,9 @@ def _combine_dates(self, df, shift_dates, scd_data):
27112711

27122712
logger.debug('Merge of dates: Elapsed time: %f' % (pd.Timestamp.utcnow() - timer_start).total_seconds())
27132713

2714-
# Move start date from index to column and give the remaining (integer-)index a name
2714+
# Move start date from index to column and add deviceid to index
27152715
result_df.reset_index(inplace=True)
2716-
result_df.index.name = self.auto_index_name
2716+
result_df.set_index(pd.Index([entity for i in range(result_df.index.size)], name=self.execute_by), inplace=True)
27172717

27182718
# Add column for end_date: Because we have all dates in index the end date is the next start date
27192719
result_df[self._end_date] = result_df[self._start_date].shift(-1)
@@ -2722,7 +2722,7 @@ def _combine_dates(self, df, shift_dates, scd_data):
27222722
# remove gaps
27232723
result_df = result_df[result_df[self._activity] != gap_indicator]
27242724

2725-
# result_df has start_date, end_date and activity
2725+
# result_df has start_date, end_date and activity; index is the group key
27262726

27272727
return result_df
27282728

0 commit comments

Comments
 (0)