Question: Im trying to make a header in NextJS but this keeps happenning:

[![enter image description here](https://i.stack.imgur.com/Y9aUE.png)](https://i.stack.imgur.com/Y9aUE.png)

I tried to use 100% width, 100% height.

My code:

```
import type { NextPage } from 'next';
import { Fragment } from 'react';
import Header from '../../components/Header';

const Home: NextPage = () => {
  return (
    <Fragment>
      <Header />
      <div>Home</div>
    </Fragment>
  );
};

export default Home;

```

The header component(its a div with background color black):

```
import { Container } from './styled';

const Header = () => {
  return <Container>HEADER</Container>;
};

export default Header;

```

[![enter image description here](https://i.stack.imgur.com/M4zDa.png)](https://i.stack.imgur.com/M4zDa.png)

Answer: 
You can split your your dataframe based on column names, using normal indexing operator `[]`, sort alphabetically the other columns using `sort_index(axis=1)`, and `concat` back together:

```
>>> pd.concat([df[['subject','timepoint']],
           df[df.columns.difference(['subject', 'timepoint'])]\
               .sort_index(axis=1)],ignore_index=False,axis=1)

    subject  timepoint  a  b  c  d
0         1          1  2  2  2  2
1         1          2  3  3  3  3
2         1          3  4  4  4  4
3         1          4  5  5  5  5
4         1          5  6  6  6  6
5         1          6  7  7  7  7
6         2          1  3  3  3  3
7         2          2  4  4  4  4
8         2          3  1  1  1  1
9         2          4  2  2  2  2
10        2          5  3  3  3  3
11        2          6  4  4  4  4
12        3          1  5  5  5  5
13        3          2  4  4  4  4
14        3          4  5  5  5  5
15        4          1  8  8  8  8
16        4          2  4  4  4  4
17        4          3  5  5  5  5
18        4          4  6  6  6  6
19        4          5  2  2  2  2
20        4          6  3  3  3  3

```
Specify the first two columns you want to keep (or determine them from the data), then sort all of the other columns. Use `.loc` with the correct list to then "sort" the DataFrame.

```
import numpy as np

first_cols = ['subject', 'timepoint']
#first_cols = df.columns[0:2].tolist()  # OR determine first two

other_cols = np.sort(df.columns.difference(first_cols)).tolist()

df = df.loc[:, first_cols+other_cols]

```

---

```
print(df.head())
   subject  timepoint  a  b  c  d
0        1          1  2  2  2  2
1        1          2  3  3  3  3
2        1          3  4  4  4  4
3        1          4  5  5  5  5
4        1          5  6  6  6  6

```