程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python list what is averaging function (python mean value function is what)

編輯:Python

Hello everyone, meet again, I'm your friend Quanstack Jun.

What is the difference between post and get in php?_Backend development

The difference between post and get in php is: 1. post is safer and sends a larger amount of data; 3. post can send more data types, while get can only send ASCII characters; 4. post is sent to the serverData, get is to get data from the server.5. Get will cache data, but post will not.

Recommended tutorial: python videoTutorial"

How does python find the average of a list?

The method of python function to calculate the average value of list:

Usage: mean(matrix, axis=0) where matrix is ​​a matrix and axis is a parameter

Use xhprof analysis in php7_backend development

This is a pure document. If you need it in the future, you can find it at any time and use xhprof to analyze it, which is convenient for code testing and comparative analysis (supports php7).

Take m * n matrix as an example:

axis does not set a value, averages m*n numbers, and returns a real number

axis=0: compress rows, average each column, return a 1* n matrix

axis=1: compress columns, average each row, return m * 1 matrix

>>> import numpy as np

>>> num1 = np.array([[1,2,3],[2,3,4],[3,4,5],[4,5,6]])

>>> now2 = np.mat(num1)

>>> now2

matrix([[1, 2, 3],

[2, 3, 4],

[3, 4, 5],

[4, 5, 6]])

>>> np.mean(now2) # find the mean of all elements

3.5

>>> np.mean(now2,0) # Compress rows and average each column

matrix([[ 2.5, 3.5, 4.5]])

>>> np.mean(now2,1) # Compress columns and average each row

matrix([[ 2.],

[3.],

[ 4.],

[ 5.]])

Recommended related articles: "python tutorial"

Publisher: Full-stack programmer, please indicate the source: https://javaforall.cn/127946.htmlOriginal link: https://javaforall.cn


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved