NumPy array statistical methods and sorting
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12247717.html
Basic array statistical methods
A set of mathematical functions that compute statistics about an entire array or about the data along an axis are accessible as methods of the array class.
You can use aggregations(often called reductions) like sum, mean, and std (standard deviation) either by calling the array instance method or using the top-level NumPy function.
Functions like mean, sum, max and min take an optional axis argument that computes the statistic over the given axis, resulting in an array with one fewer dimension
Other methods like cumsum and cumprod do not aggregate, instead producing an array of the intermediate results. In multidimensional arrays, accumulation functions like cumsum return an array of the same size, but with the partial aggregates computed along the indicated axis according to each lower dimensional slice.
Sorting
Like Python’s built-in list type, NumPy arrays can be sorted in-place with the sort method. You can also sort each one-dimensional section of values in a multidimensional array inplace along an axis by passing the axis number to sort.
Reference
Python for Data Analysis Second Edition
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步