What is the need of the "axis" in the cluster.mean function?

What is the work of the “axis” keyword in the given code displayed in the screenshot?
what is the use of this and how it is working?

Hi Abhishek!
The axis parameter defines the axis along which the means should be calculated. By default, the mean is computed of the flattened array. In version 1.7.0, if this is a tuple of ints, the mean is performed over multiple axes, instead of a single axis or all the axes as before. Here axis = 0 means along the column but axis = 1 will be working along the row. Notice that whenever you change the axis values in mean function, you obtain a different answer.
Hope it helps. Happy Learning!

1 Like