python創建類統計屬性_輕松創建統計數據的Python包

python創建類統計屬性

介紹 (Introduction)

Sometimes you may need a distribution figure for your slide or class. Since you are not using data, you want a quick solution.

有時,您的幻燈片或課程可能需要一個分配圖。 由于您不使用數據,因此需要快速解決方案。

A Python package, Statsfig, can create different distribution figures with one line of code.

Python套件Statsfig可以用一行代碼創建不同的分布圖。

I’d like to show you how easy it is to create each figure.

我想向您展示創建每個圖形有多么容易。

安裝 (Installation)

Using pip :

使用pip

pip install statsfig

Then import it.

然后導入。

import statsfig as sf

功能清單 (List of Functions)

There are eleven functions you can use. Ten distribution functions and one plot.

您可以使用十一個功能。 十個分布函數和一個圖。

演示地址

Function names and descriptions.
函數名稱和說明。

伯努利分布 (Bernoulli distribution)

bernofig() (bernofig())

The bernofig() function creates a Bernoulli distribution and the following table shows all the parameters.

bernofig()函數創建一個Bernoulli分布,下表顯示了所有參數。

演示地址

bernofig parameters.
bernofig參數。

The default function has a probability of 0.5 and a size of 1000.

默認函數的概率為0.5,大小為1000。

演示地址

fernofig() default function.
fernofig()默認函數。

The following example shows a probability of 0.6, a different color, and without the grid.

以下示例顯示了0.6的概率,不同的顏色并且沒有網格。

演示地址

bernofig() with different probability, color, and grid.
具有不同概率,顏色和網格的bernofig()。

二項分布 (Binomial Distribution)

binofig() (binofig())

The binofig() function creates a binomial distribution and the following table shows all the parameters.

binofig()函數創建一個二項式分布,下表顯示了所有參數。

演示地址

binofig() parameters.
binofig()參數。

The default function has a probability of 0.5 and a size of 1000.

默認函數的概率為0.5,大小為1000。

演示地址

binofig() default function.
binofig()默認函數。

The following example has a probability of 0.7, the number is trials of 30 and shifting 1 to the right.

下面的示例的概率為0.7,次數為30,向右移動1。

演示地址

binofig() example with different arguments.
具有不同參數的binofig()示例。

箱須圖 (Box and Whisker Plot)

This is the only one that is not a distribution figure.

這是唯一一個沒有分配數字的人。

箱形圖() (boxplot())

The boxplot() function creates a box and whisker plot and the following table shows all the parameters.

boxplot()函數創建一個箱須圖,下表顯示了所有參數。

演示地址

boxplot() parameters.
boxplot()參數。

The default function has the following value for the info argument.

默認函數的info參數具有以下值。

{‘bplot 1’:[-9, -4, 2, 4, 9], ‘bplot 2’:[-5, -2, 1, 3, 8], ‘bplot 3’:[1, 4, 6, 8, 10]}

The info must have a dictionary form with name:[min, lower quartile, median, upper quartile, max].

info必須具有name:[min, lower quartile, median, upper quartile, max]的字典形式。

演示地址

boxplot() default function.
boxplot()默認函數。

If you want to show only one box and whisker plot, you can do this:

如果您只想顯示一個方框圖和晶須圖,則可以執行以下操作:

演示地址

boxplot() example with different arguments.
具有不同參數的boxplot()示例。

Changing vert=False displays the plot horizontally.

更改vert=False會水平顯示繪圖。

演示地址

boxplot() example with different arguments.
具有不同參數的boxplot()示例。

卡方分布 (Chi-square Distribution)

chifig() (chifig())

The chifig() function creates a Chi-square distribution and the following table shows all the parameters.

chifig()函數創建一個卡方分布,下表顯示了所有參數。

演示地址

chifig() parameters.
chifig()參數。

The default function has [1,4,6,7] for the degree of freedom.

默認功能的自由度為[1,4,6,7]。

演示地址

chifig() default function.
chifig()默認函數。

You can change the degrees of freedom by changing the dof argument using a python list as following.

您可以使用以下python列表通過更改dof參數來更改dof

演示地址

chifig() example with different arguments.
chifig()示例具有不同的參數。

指數分布 (Exponential Distribution)

expofig() (expofig())

The expofig() function creates an Exponential distribution and the following table shows all the parameters.

expofig()函數創建指數分布,下表顯示了所有參數。

演示地址

expofig() parameters.
expofig()參數。

The default function has a standard deviation of 1 and size of 1000.

默認功能的標準偏差為1,大小為1000。

演示地址

expofig() default function.
expofig()默認函數。

You can hide the histogram by changing the hist argument to False.

您可以通過將hist參數更改為False來隱藏直方圖。

演示地址

expofig() example with different arguments.
expofig()示例具有不同的參數。

伽瑪分布 (Gamma Distribution)

gammafig() (gammafig())

The gammafig() function creates a Gamma distribution and the following table shows all the parameters.

gammafig()函數創建一個Gamma分布,下表顯示了所有參數。

演示地址

gammafig() parameters.
gammafig()參數。

The default function has a shape parameter of 5 and a size of 1000.

默認函數的shape參數為5,大小為1000。

演示地址

gammafig() default function.
gammafig()默認函數。

You can change the color by changing the color argument. You can use one of the characters {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}, which are short-hands for blue, green, red, cyan, magenta, yellow, black, and white. You can also use a hex RGB or RGBA string (e.g., '#4287f5' or '#4287f580').

您可以通過更改color參數來更改color 。 您可以使用以下字符之一: {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'} ,它們是藍色,綠色的簡寫形式,紅色,青色,洋紅色,黃色,黑色和白色。 您也可以使用十六進制RGB或RGBA字符串(例如'#4287f5''#4287f580' )。

演示地址

gammafig() example with different arguments.
帶不同參數的gammafig()示例。

正態分布 (Normal Distribution)

規范 (normcdf)

The normcdf() function creates a Normal distribution and the following table shows all the parameters.

normcdf()函數創建一個正態分布,下表顯示了所有參數。

演示地址

normcdf() parameters.
normcdf()參數。

The default function has a mean of 0 and a standard deviation of 1.

默認函數的平均值為0,標準偏差為1。

演示地址

normcdf() default function.
normcdf()默認函數。

If you wish, you can change most of the arguments as follows:

如果愿意,可以如下更改大多數參數:

演示地址

normcdf() example with different arguments.
具有不同參數的normcdf()示例。

Changing the lb, the lower quartile and the ub, the upper quartile, you can find the probability of between two values.

更改lb (下四分位數)和ub (上四分位數),您可以找到兩個值之間的概率。

演示地址

Another example of normcdf() with different arguments.
帶有不同參數的normcdf()的另一個示例。

規范pdf_std (normpdf_std)

The normpdf_std() function creates a Normal distribution with different standard deviations. The following table shows all the parameters.

normpdf_std()函數創建具有不同標準偏差的正態分布。 下表顯示了所有參數。

演示地址

normpdf_std() parameters.
normpdf_std()參數。

The default function has [1,2,3,4] for the degrees of freedom to display.

默認功能的顯示自由度為[1,2,3,4]。

演示地址

normpdf_std() default function.
normpdf_std()默認函數。

You can use a Python list to change the val argument for different degrees of freedom.

您可以使用Python列表更改不同自由度的val參數。

演示地址

normpdf_std() example with different arguments.
具有不同參數的normpdf_std()示例。

normpdf_mean (normpdf_mean)

The normpdf_mean() function creates a Normal distribution with different means. The following table shows all the parameters.

normpdf_mean()函數使用不同的方式創建正態分布。 下表顯示了所有參數。

演示地址

normpdf_mean() parameters.
normpdf_mean()參數。

The default function has [0,1,2,3] for the mean values to display.

默認功能的平均值顯示為[0,1,2,3]。

演示地址

normpdf_mean() default function.
normpdf_mean()默認函數。

You can change the title, x-axis minimum, and maximum values as follows:

您可以如下更改標題,x軸最小值和最大值:

演示地址

normpdf_mean() example with different arguments.
具有不同參數的normpdf_mean()示例。

泊松分布 (Poisson Distribution)

poisfig() (poisfig())

The poisfig() function creates a Poisson distribution and the following table shows all the parameters.

poisfig()函數創建一個泊松分布,下表顯示了所有參數。

演示地址

poisfig() parameters.
poisfig()參數。

The default function has 4 the μ value and a size of 1000.

默認函數的μ值為4,大小為1000。

演示地址

poisfig() default function.
poisfig()默認函數。

演示地址

poisfig() example with different arguments.
poisfig()示例具有不同的參數。

均勻分布 (Uniform Distribution)

uniformfig() (uniformfig())

The uniformfig() function creates a Uniform distribution and the following table shows all the parameters.

uniformfig()函數創建一個Uniform分布,下表顯示了所有參數。

演示地址

uniformfig() parameters.
Uniformfig()參數。

The default function has a size of 1000, start at 10 and a width of 20.

默認功能的大小為1000,從10開始,寬度為20。

演示地址

uniformfig() default function.
uniformfig()默認函數。

Here we are changing the color, grid, and figure width and length.

在這里,我們更改顏色,網格以及圖形的寬度和長度。

演示地址

uniformfig() example with different arguments.
具有不同參數的Uniformfig()示例。

終奌站 (Terminal)

You can create a figure from your terminal as well.

您也可以從終端創建圖形。

Image for post
Creating a figure from the terminal.
從終端創建圖形。
Image for post

結論 (Conclusion)

I hope you found it is much easier to create figures with the Statsfig package. I’d love to hear any comments about the package. Feel free to leave a message below, or reach out to me through Twitter.

我希望您發現使用Statsfig軟件包創建圖形要容易得多 。 我希望聽到有關該包裹的任何評論。 隨時在下面留言,或通過Twitter與我聯系。

Please stay tuned for the next post.

請繼續關注下一篇文章。

翻譯自: https://towardsdatascience.com/a-python-package-to-create-stats-figures-with-ease-503cf6ec0b26

python創建類統計屬性

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391970.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391970.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391970.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

pytorch深度學習_在本完整課程中學習在PyTorch中應用深度學習

pytorch深度學習In this complete course from Fawaz Sammani you will learn the key concepts behind deep learning and how to apply the concepts to a real-life project using PyTorch. 在Fawaz Sammani的完整課程中,您將學習深度學習背后的關鍵概念&#x…

html讓a標簽左右一樣寬,button和a標簽設置相同的css樣式,但是寬度不同

登錄注冊.btn {display: block;-moz-appearance: none;background: rgba(0, 0, 0, 0) none repeat scroll 0 0;border-radius: 0.25rem;box-sizing: border-box;cursor: pointer;font-family: inherit;font-size: 0.8rem;height: 2rem;line-height: 1.9rem;margin: 0;padding: …

淺析STM32之usbh_def.H

【溫故而知新】類似文章淺析USB HID ReportDesc (HID報告描述符) 現在將en.stm32cubef1\STM32Cube_FW_F1_V1.4.0\Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_def.H /********************************************************************************* file us…

spring—依賴注入

依賴注入(Dependency Injection) 它是 Spring 框架核心 IOC 的具體實現。 在編寫程序時,通過控制反轉,把對象的創建交給了 Spring,但是代碼中不可能出現沒有依賴的情況。 IOC 解耦只是降低他們的依賴關系,…

C# (類型、對象、線程棧和托管堆)在運行時的相互關系

在介紹運行時的關系之前,先從一些計算機基礎只是入手,如下圖: 該圖展示了已加載CLR的一個windows進程,該進程可能有多個線程,線程創建時會分配到1MB的棧空間.棧空間用于向方法傳遞實參,方法定義的局部變量也在實參上,上圖的右側展示了線程的棧內存,棧從高位內存地址向地位內存地…

2019-08-01 紀中NOIP模擬賽B組

T1 [JZOJ2642] 游戲 題目描述 Alice和Bob在玩一個游戲,游戲是在一個N*N的矩陣上進行的,每個格子上都有一個正整數。當輪到Alice/Bob時,他/她可以選擇最后一列或最后一行,并將其刪除,但必須保證選擇的這一行或這一列所有…

knn分類 knn_關于KNN的快速小課程

knn分類 knnAs the title says, here is a quick little lesson on how to construct a simple KNN model in SciKit-Learn. I will be using this dataset. It contains information on students’ academic performance.就像標題中所說的,這是關于如何在SciKit-Le…

spring—配置數據源

數據源(連接池)的作用 數據源(連接池)是提高程序性能如出現的 事先實例化數據源,初始化部分連接資源 使用連接資源時從數據源中獲取 使用完畢后將連接資源歸還給數據源 常見的數據源(連接池):DBCP、C3P0、BoneCP、Druid等 開發步…

大型網站系統與Java中間件實踐pdf

下載地址:網盤下載 基本介紹 編輯內容簡介 到底是本什么書,擁有這樣一份作序推薦人列表:阿里集團章文嵩博士|新浪TimYang|去哪網吳永強|丁香園馮大輝|蘑菇街岳旭強|途牛湯崢嶸|豆瓣洪強寧|某電商陳皓/林昊…… 這本書出自某電商技術部總監之手…

office漏洞利用--獲取shell

環境: kali系統, windows系統 流程: 在kali系統生成利用文件, kali系統下監聽本地端口, windows系統打開doc文件,即可中招 第一種利用方式, 適合測試用: 從git下載代碼: …

pandas之DataFrame合并merge

一、merge merge操作實現兩個DataFrame之間的合并,類似于sql兩個表之間的關聯查詢。merge的使用方法及參數解釋如下: pd.merge(left, right, onNone, howinner, left_onNone, right_onNone, left_indexFalse, right_indexFalse,    sortFalse, suffi…

typescript_如何掌握高級TypeScript模式

typescriptby Pierre-Antoine Mills皮埃爾安托萬米爾斯(Pierre-Antoine Mills) 如何掌握高級TypeScript模式 (How to master advanced TypeScript patterns) 了解如何為咖喱和Ramda創建類型 (Learn how to create types for curry and Ramda) Despite the popularity of curry…

html函數splice,js數組的常用函數(slice()和splice())和js引用的三種方法總結—2019年1月16日...

總結:slice()和splice()slice(參數1,參數2)可以查找數組下對應的數據,參數1為起始位置,參數2為結束位置,參數2可以為負數,-1對應的是從后向前數的第一個數值。splice()可以進行增刪改查數據操作,splice(參數…

leetcode 643. 子數組最大平均數 I(滑動窗口)

給定 n 個整數,找出平均數最大且長度為 k 的連續子數組,并輸出該最大平均數。 示例: 輸入:[1,12,-5,-6,50,3], k 4 輸出:12.75 解釋:最大平均數 (12-5-650)/4 51/4 12.75 代碼 class Solution {publ…

python ==字符串

字符串類型(str): 包含在引號(單,雙,三)里面,由一串字符組成。 用途:姓名,性別,地址,學歷,密碼 Name ‘zbk’ 取值: 首先要明確,字符…

認證鑒權與API權限控制在微服務架構中的設計與實現(一)

作者: [Aoho’s Blog] 引言: 本文系《認證鑒權與API權限控制在微服務架構中的設計與實現》系列的第一篇,本系列預計四篇文章講解微服務下的認證鑒權與API權限控制的實現。 1. 背景 最近在做權限相關服務的開發,在系統微服務化后&a…

mac下完全卸載程序的方法

在國外網上看到的,覺得很好,不僅可以長卸載的知識,還對mac系統有更深的認識。比如偏好設置文件,我以前設置一個程序壞了,打不開了,怎么重裝都打不開,后來才知道系統還保留著原來的偏好設置文件。…

機器學習集群_機器學習中的多合一集群技術在無監督學習中應該了解

機器學習集群Clustering algorithms are a powerful technique for machine learning on unsupervised data. The most common algorithms in machine learning are hierarchical clustering and K-Means clustering. These two algorithms are incredibly powerful when appli…

自考本科計算機要學什么,計算機自考本科需要考哪些科目

高科技發展時代,怎離得開計算機技術?小學生都要學編程了,未來趨勢一目了然,所以如今在考慮提升學歷的社會成人,多半也青睞于計算機專業,那么計算機自考本科需要考哪些科目?難不難?自…

審查指南 最新版本_代碼審查-最終指南

審查指南 最新版本by Assaf Elovic通過阿薩夫埃洛維奇 代碼審查-最終指南 (Code Review — The Ultimate Guide) 構建團隊代碼審查流程的終極指南 (The ultimate guide for building your team’s code review process) After conducting hundreds of code reviews, leading R…