I have a dataframe
df_in = pd.DataFrame([["A","X",5,4,1],["B","Y",3,3,1],["C","Y",4,7,4]], columns=['col1', 'col2', 'col3', 'col4','col5'])
I want to repeat a row n no. of times and the count also should increase from the no. present in col4.
Ex: I want to repeat the B row 3 times and count in col4 will increse from the current value present in col4 like 3,4 and 5. Similarly for C row repeat 2 times and increase the count in col4 from the current value.
Expected Output:
df_Out = pd.DataFrame([["A","X",5,4,1],["B","Y",3,3,1],["B","Y",3,4,1],["B","Y",3,5,1],["C","Y",4,7,4],["C","Y",4,8,4]], columns=['col1', 'col2', 'col3', 'col4','col5'])
How to do it?