Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use Python and R to realize descriptive Statistics

Shulou Source: shulou.com Published: 2022-06-01 04:13:25 10月14日 Update

Today, the editor will share with you how to use Python and R to achieve descriptive statistics. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Descriptive statistics

Descriptive statistics are statistical means to describe data with the help of charts or summing-up values. In the data analysis stage of data mining, descriptive statistics can be used to describe or summarize the basic situation of the data.

Python implementation

From numpy import mean,median,ptp,var,stdimport numpy as npimport pandas as pd# arithmetic mean data = [1] 2, 3, 4, 5, 5, 5, 5, 6, 7, and 8. 8] data_mean = mean (data) print ("arithmetic mean =") print (data_mean) # median data_median = median (data) print ("median =") print (data_median) # mode data_mode = mode (data) print ("mass =") print (data_mode) # range data_range = max (data)-min (data) print ("range =") print (data_range) # Variance and standard deviation data_var = Var (data) print ("Variance =") print (data_var) # Standard deviation data_sd = std (data) print ("Standard deviation =") print (data_sd) # coefficient of variation data_cv = mean (data) / std (data) print ("coefficient of variation =") print (data_cv) # quarterback range dt = pd.Series 3) print ('Q1 print, dt.quantile (.25)) print ('Q3, dt.quantile (.75)) print ('Q3-Q1, dt.quantile (.75)-dt.quantile (.25))

R realization

# my_describe functions organized into descriptive statistics

Tags: Statistics descriptive data knowledge articles standards median content variation variance arithmetic coefficient difference very large function chart basic situation most that is average Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Shulou Technology MariaDB MySQL