Segmenting a list of data; python

Viewed 69

"Deleted" ...........

2 Answers

You nearly did it:

for i in range(0, len(data_segment)):   # <-- looping thru data_segment
    # data_segment = list_segmented[i]   <--  this was back to front.
    list_segmented[i] = data_segment   # <--  this will work

note: there are cleaner ways of doing this in python (like list comprehension).

Anyway, good question. Hope that helps.

It looks like the lines

condition = sym.has_symptom(data_segment, interval, threshold)
disorder_status.append(condition)

should each be indented by one more level to be inside the for loop, so that they are executed for each data segment.

You presumably also want to return disorder_status at the end of the function.

Related