Start_Year End_Year Opp1 Opp2 Duration
1500 1501 ['A','B'] ['C','D'] 1
1500 1510 ['P','Q','R'] ['X','Y'] 10
1520 1520 ['A','X'] ['C'] 0
... .... ........ ..... ..
1809 1820 ['M'] ['F','H','Z'] 11
My dataset(csv file format) is of armed wars fought between different entities(countries, states, and factions represented by Capital letters A, B, P, Q etc as lists in Opp1(opposition) and Opp2 columns. Start_Year and End_Year are the years about when the war started and when it ended. The Duration column is created by subtracting values of End_Year to Start_Year.
I want to replicate those rows with Duration greater than 0 by the factor of the Duration of war i.e if duration is 6 years then replicate that row 6 times and decrease the Duration values by 1 and increase the Start_Year by 1 for every replication in replicated rows and keep the values in other columns same.(if duration is 1 year then it should replicate the row 2 times so that duration becomes 0 years for every war after replication to last step). My desired output column is like this:
I have no clue how to proceed with something like this as I am a beginner in data science and analysis. So pardon me for not showing any trial codes here.
Start_Year End_Year Opp1 Opp2 Duration
1500 1501 ['A','B'] ['C','D'] 1
1501 1501 ['A','B'] ['C','D'] 0
1500 1510 ['P','Q','R'] ['X','Y'] 10
1501 1510 ['P','Q','R'] ['X','Y'] 9
1502 1510 ['P','Q','R'] ['X','Y'] 8
1503 1510 ['P','Q','R'] ['X','Y'] 7
1504 1510 ['P','Q','R'] ['X','Y'] 6
1505 1510 ['P','Q','R'] ['X','Y'] 5
.... .... ............. ........ ..
1510 1510 ['P','Q','R'] ['X','Y'] 0
1520 1520 ['A','X'] ['C'] 0
... .... ........ ..... ..
1809 1820 ['M'] ['F','H','Z'] 11
1810 1820 ['M'] ['F','H','Z'] 10
.... .... ..... .............. ..
1820 1820 ['M'] ['F','H','Z'] 0
Edit:1 Some example dataset The Dataset