Skip to main content

Python NumPy: Finding Square Root and Standard Deviation

Finding square root using numpy.sqrt()

 This function returns a non-negative(or positive) square root of each element of the given array.




It takes input array whose whose square-roots are required.


It returns the array which has positive square root of each element of input array. 


import numpy as np


[[1.         4.58257569 6.55743852]
 [8.06225775 2.64575131 8.94427191]]

Finding standard deviation using numpy.std():

It is used to compute the standard deviation of the array elements along the specified axis. Standard Deviation is used to measure that how the spread of data distribution is in the given array.


numpy.std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=
<class numpy._globals._NoValue>) 


  1. a: The input array whose elements are used to calculate the standard deviation.
  2. axis: It is optional.The axis along which we want to calculate the standard deviation.
  3. dtype: It defines the data type. It is used to calculate the standard deviation.
  4. out: It is used to define the output array in which the result is to be placed. 
  5. ddof: Delta Degrees of Freedom,This N-ddof divisor is used in calculations, where N represent the number of elements. It is by default 0.
  6. keepdims:  It is optional. When the value is true.It will leave the reduced axis as dimensions with size one in the resultant.


It returns a new array which has the standard deviation. If out is None,then it will return the output array’s reference.


import numpy as np

Output: 25.628217955128203

Submitted by devanshi.srivastava on August 9, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.