I have a set of lists like so:
listoflists = ['list1','list2']
list1_start = pd.DataFrame([1,6,11,24,33,45,55])
list1_end = pd.DataFrame([2,8,15,26,37,48,90])
list2_start = pd.DataFrame([5,9,44,72])
list2_end = pd.DataFrame([7,17,52,80])
I would like to create a new list of numbers for inbetween the start and end lists:
expected outcome:
list1_duration = [1,1.5,2,6,6.5,7,7.5,8,11,11.5,12,12.5,13,13.5,14,14.5,15....
list2_dutation = [5.5,6,6.5,7,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.6,17...
I tried to get the difference between the two and then create a range for those differences that I can add back to the starting list, but all i managed to get were a list of ranges, also that is just for one list and I don't know how to iterate through all the lists from list of lists (tried, but failed).
list1_dif = (list1_end)-(list1_start)
list1_dif = list1_dif[0].tolist()
list1_dur = []
for i in range(len(list1_dif)):
command = ''
command = 'list1_dur.append(list(range('+str(list1_dif[i])+')))'
exec(command)
list1_duration = list1_dur + list1_start
print(list1_dur)
output:
[[0], [0, 1], [0, 1, 2, 3], [0, 1], [0, 1, 2, 3], [0, 1, 2], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]]
Can anyone help me out on this?
Thanks,
Gergely