I have this dataframe:
0 1 2 3
0 Frank 48.2 test_1 file_1
1 John 46.7 test_1 file_1
2 Alice 39.3 test_2 file_2
3 Kim 35.6 test_2 file_2
4 Sasha 25.5 test_3 file_3
....
2306 rows × 4 columns
I want that for every different value on the column 2 (there are 140 different values), it will be added a row in my dataframe before the first row with that value, keeping the file_number value in the column 3 (I will need that column for saving the dataframe splitted in different files depending on the value in it), like this:
0 1 2 3
0 test_1 file_1
1 Frank 48.2 test_1 file_1
2 John 46.7 test_1 file_1
3 test_2 file_2
4 Alice 39.3 test_2 file_2
5 Kim 35.6 test_2 file_2
6 test_3 file_3
7 Sasha 25.5 test_3 file_3
....
Which is the simplest way to achieve it? Thank you for your time!