root mean square in numpy and complications of matrix and arrays of numpy

后端 未结 6 840
猫巷女王i
猫巷女王i 2021-02-07 05:38

Can anyone direct me to the section of numpy manual where i can get functions to accomplish root mean square calculations ... (i know this can be accomplished using np.mean and

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 06:00

    I don't know why it's not built in. I like

    def rms(x, axis=None):
        return sqrt(mean(x**2, axis=axis))
    

    If you have nans in your data, you can do

    def nanrms(x, axis=None):
        return sqrt(nanmean(x**2, axis=axis))
    

提交回复
热议问题