I have an interesting case. In column FID2
I have some values, based on each i'd like to create a list. The column Ncircles
determines the list.
For example:
- If there's a value
0
inNcircles
, i'd like to create a list based on the value inFID2
in the same row as[i]
, wherei
is equal toFID2
. - If there's a value
1
inNcircles
, i'd like to create a list based on the value inFID2
in the same row as[i-1, i, i +1]
, wherei
is equal toFID2
. - If there's a value
3
inNcircles
, i'd like to create a list based on the value inFID2
in the same row as[i-3, i-2, i -1 i, i+1, i+2, i +3]
, wherei
is equal toFID2
.
This is an example of df:
FID2 Ncircles
0 50141 0
1 56188 1
2 75035 0
3 94937 3
The final lists can be written all in the same, one list. Do you have any suggestions how to do this?
An expected output would be a new list:
Newlist = [50141, 56187, 56188, 56188, 75035, 94934, 94935, 94936, 94937, 94938, 94939, 94940]