I will write about numerical summarization, which is the basic summarization method for data analysis.
import numpy as np
x=np.array([1,2,3,4.5,5,6.5,7,8,9,10])
average=np.mean(x) ///Mean value mean function///
(Out 5.6)
med=np.median(x) ///Median function///
(Out 5.75)
var.p=np.var(x) ///Sample variance var function///
(Out 8.19)
std=np.std(x) ///Standard deviation std function///
(Out 2.86)
Please refer to here for the meaning of each word. https://note.com/karaage_love/n/n6f617d38c528
import numpy as np
import matplotlib.pyplot as plt
array=np.loadtxt(fname='example.csv',delimiter=',',encoding="utf-8_sig")
///example.csv contains two columns of data.///
array_x=array[:,0]
array_y=array[:,1] ///slice///
plt.scatter(araay_x,array_y,s=10,c='blue',alpha='0.5')
///Creating a scatter plot s is the size c is the color of the scatter plot alpha is the transparency///
np.cov(array_x,array_y,bias=True)
(Out [[6.72727273 3.54545455]
[3.54545455 6. ]])
//The covariance result is a 2 × 2 matrix. The diagonal components are the variances of x and y, respectively. The rest is covariance.///
np.corrcoef(array_x,array_y)
(Out [[1. 0.55805471]
[0.55805471 1. ]]
///Correlation coefficient: After all, the correlation coefficient is other than the diagonal component.///
See here for a detailed summary of 2D data. https://note.com/karaage_love/n/n992a7fdf9b1f
Recommended Posts