0

I am currently trying to subtract subtract a specific range of a list from a specific value in the list. This is easy enough however, the data is stored in an index and I am unsure of how to access the list within the index to complete the subtraction.

Below is the code I have written with images of the index and lists I want to access.

dfos_delta_zero = dfos_delta[:]
for i in range(len(dfos_delta_zero)):
    for j in range(len(dfos_delta_zero[i][0:200])):
        dfos_delta_zero[i][j]= dfos_delta_zero[i][j]-dfos_delta_zero[i][0]

The dfos_delta_zero function holding 4 lists One of the lists in the array that I am trying to subtract one value from the list from each point Thanks!

The main issue I am having is I want to subtract multiple parts of the list separately like point 0-200 from point 0 an point 201-400 from point 201. Any tips would be great!

  • Please post your data as plain text, not images. – Barmar Feb 13 '23 at 16:22
  • What do you mean by "the data is stored in an index"? – Barmar Feb 13 '23 at 16:24
  • `dfos_delta_zero` is a variable, not a funcction. – Barmar Feb 13 '23 at 16:24
  • `dfos_delta_zero` is a shallow copy of `dfos_delta`. If you don't want to modify the original arrays, you should make a deep copy. – Barmar Feb 13 '23 at 16:25
  • I'm not sure I understand what you want, but I think [how to split a list into chunks](https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks) will be helpful. – Barmar Feb 13 '23 at 16:28

0 Answers0