I asked this question yesterday but was unclear about a couple things so I'm reposting it here. Basically I have a dataframe of 13 columns and over 500 rows and I'm trying to add a header every x number of rows.
I'm a beginner so I've tried .concat and .append but I'm not sure if I really am doing it right
I have the variable header = ['Rk', 'Player', 'Age',...]
In: print(final.head())
out:
   index            Player Age   Tm Pos  GP   G   A    P +/- PPP    TOI
0      0   Nikita Kucherov  25  TBL  RW  82  41  87  128  24  41  19:58
1      4     Brad Marchand  30  BOS  LW  79  36  64  100  15  33  19:37
2      5     Sidney Crosby  31  PIT   C  79  35  65  100  18  20  21:00
3      6  Nathan MacKinnon  23  COL   C  82  41  58   99  20  31  22:05
4      7   Johnny Gaudreau  25  CGY  LW  82  36  63   99  18  29  20:04
I want to print the header every 48 rows, if I wanted to print it every 2 rows it would look like this:
In: print(final.head())
out:
   index            Player Age   Tm Pos  GP   G   A    P +/- PPP    TOI
0      0   Nikita Kucherov  25  TBL  RW  82  41  87  128  24  41  19:58
1      4     Brad Marchand  30  BOS  LW  79  36  64  100  15  33  19:37
                    Player Age   Tm  Pos GP   G   A    P  +/- PPP   TOI
2      5     Sidney Crosby  31  PIT   C  79  35  65  100  18  20  21:00
3      6  Nathan MacKinnon  23  COL   C  82  41  58   99  20  31  22:05
                    Player Age   Tm  Pos GP   G   A    P  +/- PPP   TOI
4      7   Johnny Gaudreau  25  CGY  LW  82  36  63   99  18  29  20:04
Note I don't really care about the what the value is for the index column for the header row when I insert multiple times, I'm pretty lenient for that part.