This will return the median of every row.

- Axis 1 will act on all the COLUMNS in each ROW

Let me explain this below:

```
df = pd.DataFrame(
{'a':range(5), 'b':range(5,10), 'c':range(10,15)},
index=['index_'+str(x) for x in range(5)]
)
```

#
`axis=0`

: What is the median Columnwise?

Suppose I want the median of every column, I will use `axis=0`

since this will act on all the ROWS in each COLUMN, in many pandas function without specifying the `axis`

by default it will act on ROWS in each COLUMN

```
df.median()
```

The Output will be:

```
a 2.0
b 7.0
c 12.0
dtype: float64
```

See I’ve got the median of column `a`

, `b`

and `c`

```
df.median(axis=0)
```

The output will be as above

```
a 2.0
b 7.0
c 12.0
dtype: float64
```

let’s see the output of the medians of Column `a`

and column `b`

```
medians = df[['a', 'b']].median(axis=0)
medians
```

The output

```
a 2.0
b 7.0
dtype: float64
```

#
`axis=1`

: What is the median ROWwise?

To get the median across the ROWs I will set `axis=1`

```
df.median(axis=1)
```

The output will be:

```
index_0 5.0
index_1 6.0
index_2 7.0
index_3 8.0
index_4 9.0
dtype: float64
```

It has given me the median of every ROW.

I hope it is clear now.

Always REMEMBER:

- Axis 0 will act on all the ROWS in each COLUMN
- Axis 1 will act on all the COLUMNS in each ROW