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.mzph.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…