鲜为人知的6个黑科技网站

Pandas is the go-to Python library for data analysis and manipulation. It provides numerous functions and methods that expedice the data analysis process.

Pandas是用于数据分析和处理的Python库。 它提供了加速数据分析过程的众多功能和方法。

When it comes to data visualization, pandas is not the prominent choice because there exist great visualization libraries such as matplotlib, seaborn, and plotly.

在数据可视化方面,大熊猫并不是首选,因为存在强大的可视化库,例如matplotlib,seaborn和plotly。

With that being said, we cannot just ignore the plotting tools of pandas. They help to discover relations within dataframes or series and syntax is pretty simple. Very informative plots can be created with just one line of code.

话虽如此,我们不能仅仅忽略熊猫的绘图工具。 它们有助于发现数据框或序列中的关系,语法非常简单。 只需一行代码就可以创建非常有用的图。

In this post, we will cover 6 plotting tools of pandas which definitely add value to the exploratory data analysis process.

在本文中,我们将介绍6种熊猫绘图工具,这些工具肯定会为探索性数据分析过程增添价值。

The first step to create a great machine learning model is to explore and understand the structure and relations within the data.

创建出色的机器学习模型的第一步是探索和理解数据内的结构和关系。

These 6 plotting tools will help you understand the data better:

这6种绘图工具将帮助您更好地理解数据:

  • Scatter matrix plot

    散点图

  • Density plot

    密度图

  • Andrews curves

    安德鲁斯曲线

  • Parallel coordinates

    平行坐标

  • Lag plots

    滞后图

  • Autocorrelation plot

    自相关图

I will use a diabetes dataset available on kaggle. Let’s first read the dataset into a pandas dataframe.

我将使用kaggle上提供的糖尿病数据集 。 首先让我们将数据集读入pandas数据框。

import pandas as pdimport numpy as npimport matplotlib.pyplot as plt%matplotlib inlinedf = pd.read_csv("/content/diabetes.csv")print(df.shape)df.head()

The dataset contains 8 numerical features and a target variable indicating if the person has diabetes.

该数据集包含8个数字特征和一个指示该人是否患有糖尿病的目标变量。

1.散点图 (1. Scatter matrix plot)

Scatter plots are typically used to explore the correlation between two variables (or features). The values of data points are shown using the cartesian coordinates.

散点图通常用于探索两个变量(或特征)之间的相关性。 使用笛卡尔坐标显示数据点的值。

Scatter plot matrix produces a grid of scatter plots with just one line of code.

散点图矩阵仅用一行代码即可生成散点图的网格。

from pandas.plotting import scatter_matrixsubset = df[['Glucose','BloodPressure','Insulin','Age']]scatter_matrix(subset, figsize=(10,10), diagonal='hist')

I’ve selected a subset of the dataframe with 4 features for demonstration purposes. The diagonal shows the histogram of each variable but we can change it to show kde plot by setting diagonal parameter as ‘kde’.

为了演示目的,我选择了具有4个功能的数据框的子集。 对角线显示每个变量的直方图,但我们可以通过将对角线参数设置为' kde '来更改它以显示kde图。

2.密度图 (2. Density plot)

We can produce density plots using kde() function on series or dataframe.

我们可以在系列或数据框上使用kde()函数生成密度图。

subset = df[['Glucose','BloodPressure','BMI']]subset.plot.kde(figsize=(12,6), alpha=1)

We are able to see the distribution of features with one line of code. Alpha parameter is used to adjust the darkness of lines.

我们可以用一行代码看到功能的分布。 Alpha参数用于调整线条的暗度。

3.安德鲁斯曲线 (3. Andrews curves)

Andrews curves, named after the statistician David F. Andrews, is a tool to plot multivariate data with lots of curves. The curves are created using the attributes (features) of samples as coefficients of Fourier series.

以统计学家大卫·安德鲁斯(David F. 使用样本的属性(特征)作为傅立叶级数的系数来创建曲线。

We get an overview of clustering of different classes by coloring the curves that belong to each class differently.

我们通过对属于每个类别的曲线进行不同的着色来获得对不同类别的聚类的概述。

from pandas.plotting import andrews_curvesplt.figure(figsize=(12,8))subset = df[['Glucose','BloodPressure','BMI', 'Outcome']]andrews_curves(subset, 'Outcome', colormap='Paired')

We need to pass a dataframe and name of the variable that hold class information. Colormap parameter is optional. There seems to be a clear distinction (with some exceptions) between 2 classes based on the features in subset.

我们需要传递一个保存类信息的数据框和变量名。 Colormap参数是可选的。 根据子集中的功能,两个类之间似乎有明显的区别(有些例外)。

4.平行坐标 (4. Parallel coordinates)

Parallel coordinates is another tool for plotting multivariate data. Let’s first create the plot and then talk about what it tells us.

平行坐标是另一个用于绘制多元数据的工具。 让我们首先创建情节,然后谈论它告诉我们的内容。

from pandas.plotting import parallel_coordinatescols = ['Glucose','BloodPressure','BMI', 'Age']plt.figure(figsize=(12,8))parallel_coordinates(df,'Outcome',color=['Blue','Gray'],cols=cols)

We first import parallel_coordinates from pandas plotting tools. Then create a list of columns to use. Then a matplotlib figure is created. The last line creates parallel coordinates plot. We pass a dataframe and name of the class variable. Color parameter is optional and used to determine colors for each class. Finally cols parameter is used to select columns to be used in the plot. If not specified, all columns are used.

我们首先从熊猫绘图工具导入parallel_coordinates 。 然后创建要使用的列的列表。 然后创建一个matplotlib图形。 最后一行创建平行坐标图。 我们传递一个数据框和类变量的名称。 Color参数是可选的,用于确定每个类的颜色。 最后, cols参数用于选择要在绘图中使用的列。 如果未指定,则使用所有列。

Each column is represented with a vertical line. The horizontal lines represent data points (rows in dataframe). We get an overview of how classes are separated according to features. “Glucose” variable seems to a good predictor to separate these two classes. On the other hand, lines of different classes overlap on “BloodPressure” which indicates it does not perform well in separating the classes.

每列均以垂直线表示。 水平线代表数据点(数据帧中的行)。 我们对如何根据功能分离类进行了概述。 “葡萄糖”变量似乎是区分这两个类别的良好预测指标。 另一方面,不同类别的行在“ BloodPressure”上重叠,这表明在分隔类别时效果不佳。

5.滞后图 (5. Lag plot)

Lag plots are used to check the randomness in a data set or time series. If a structure is displayed in lag plot, we can conclude that the data is not random.

滞后图用于检查数据集或时间序列中的随机性。 如果在滞后图中显示结构,则可以得出结论,数据不是随机的。

from pandas.plotting import lag_plotplt.figure(figsize=(10,6))lag_plot(df)

There is no structure in our data set that indicates randomness.

我们的数据集中没有任何结构表明随机性。

Let’s see an example of non-random data. I will use the synthetic sample in pandas documentation page.

让我们看一个非随机数据的例子。 我将在pandas文档页面中使用合成样本。

spacing = np.linspace(-99 * np.pi, 99 * np.pi, num=1000)data = pd.Series(0.1 * np.random.rand(1000) + 0.9 * np.sin(spacing))plt.figure(figsize=(10,6))lag_plot(data)

We can clearly see a structure on lag plot so the data is not random.

我们可以清楚地看到滞后图上的结构,因此数据不是随机的。

6.自相关图 (6. Autocorrelation plot)

Autocorrelation plots are used to check the randomness in time series. They are produced by calculating the autocorrelations for data values at varying time lags.

自相关图用于检查时间序列中的随机性。 它们是通过计算在不同时滞下数据值的自相关来产生的。

Lag is the time difference. If the autocorrelations are very close to zero for all time lags, the time series is random.

滞后是时差。 如果对于所有时滞,自相关都非常接近零,则时间序列是随机的。

If we observe one or more significantly non-zero autocorrelations, then we can conclude that time series is not random.

如果我们观察到一个或多个显着的非零自相关,则可以得出时间序列不是随机的结论。

Let’s first create a random time series and see the autocorrelation plot.

我们首先创建一个随机时间序列,然后查看自相关图。

noise = pd.Series(np.random.randn(250)*100)noise.plot(figsize=(12,6))

This time series is clearly random. The autocorrelation plot of this time series:

这个时间序列显然是随机的。 该时间序列的自相关图:

from pandas.plotting import autocorrelation_plotplt.figure(figsize=(12,6))autocorrelation_plot(noise)

As expected, all autocorrelation values are very close to zero.

不出所料,所有自相关值都非常接近零。

Let’s do an example of non-random time series. The plot below shows a very simple upward trend.

让我们举一个非随机时间序列的例子。 下图显示了非常简单的上升趋势。

upward = pd.Series(np.arange(100))upward.plot(figsize=(10,6))plt.grid()

The autocorrelation plot for this time series:

此时间序列的自相关图:

plt.figure(figsize=(12,6))autocorrelation_plot(upward)

This autocorrelation clearly indicates a non-random time series as there are many significantly non-zero values.

由于存在许多明显的非零值,因此这种自相关清楚地指示了非随机时间序列。

It is very easy to visually check the non-randomness of simple upward and downward trends. However, in real life data sets, we are likely to see highly complex time series. We may not able see the trends or seasonality in those series. In such cases, autocorrelation plots are very helpful for time series analysis.

直观地检查简单的向上和向下趋势的非随机性非常容易。 但是,在现实生活中的数据集中,我们可能会看到非常复杂的时间序列。 我们可能看不到那些系列的趋势或季节性。 在这种情况下,自相关图对于时间序列分析非常有帮助。

Pandas provide two more plotting tools which are bootstap plot and RadViz. They can also be used in exploratory data analysis process.

熊猫提供了另外两种绘图工具,即引导绘图和RadViz 。 它们也可以用于探索性数据分析过程。

Thank you for reading. Please let me know if you have any feedback.

感谢您的阅读。 如果您有任何反馈意见,请告诉我。

翻译自: https://towardsdatascience.com/6-lesser-known-pandas-plotting-tools-fda5adb232ef

鲜为人知的6个黑科技网站


http://www.taodudu.cc/news/show-995070.html

相关文章:

  • 数据eda_关于分类和有序数据的EDA
  • 优化 回归_使用回归优化产品价格
  • 大数据数据科学家常用面试题_进行数据科学工作面试
  • vue.js python_使用Python和Vue.js自动化报告过程
  • 计算机科学必读书籍_5篇关于数据科学家的产品分类必读文章
  • python 网页编程_通过Python编程检索网页
  • data studio_面向营销人员的Data Studio —报表指南
  • 乐高ev3 读取外部数据_数据就是新乐高
  • java 分裂数字_分裂的补充:超越数字,打印物理可视化
  • 比赛,幸福度_幸福与生活满意度
  • 5分钟内完成胸部CT扫描机器学习
  • openai-gpt_为什么到处都看到GPT-3?
  • 数据可视化及其重要性:Python
  • ai驱动数据安全治理_AI驱动的Web数据收集解决方案的新起点
  • 使用K-Means对美因河畔法兰克福的社区进行聚类
  • 因果关系和相关关系 大数据_数据科学中的相关性与因果关系
  • 分类结果可视化python_可视化分类结果的另一种方法
  • rstudio 管道符号_R中的管道指南
  • 时间序列因果关系_分析具有因果关系的时间序列干预:货币波动
  • 无法从套接字中获取更多数据_数据科学中应引起更多关注的一个组成部分
  • 深度学习数据更换背景_开始学习数据科学的最佳方法是了解其背景
  • 数据中台是下一代大数据_全栈数据科学:下一代数据科学家群体
  • 泰坦尼克数据集预测分析_探索性数据分析-泰坦尼克号数据集案例研究(第二部分)
  • 大数据技术 学习之旅_如何开始您的数据科学之旅?
  • 搜索引擎优化学习原理_如何使用数据科学原理来改善您的搜索引擎优化工作
  • 一件登录facebook_我从Facebook的R教学中学到的6件事
  • python 图表_使用Streamlit-Python将动画图表添加到仪表板
  • Lockdown Wheelie项目
  • 实现klib_使用klib加速数据清理和预处理
  • 简明易懂的c#入门指南_统计假设检验的简明指南

鲜为人知的6个黑科技网站_6种鲜为人知的熊猫绘图工具相关推荐

  1. 手机网站按住放大图片_这6个鲜为人知的黑科技网站,我可以玩一天

    以前App推荐了很多,今天就种草几个黑科技网站,绝对带劲. 1. 全历史 >地址:https://www.allhistory.com/ 这个网站真不一般,它的牛逼之处简单概括就是一个把公园前3 ...

  2. 5 个鲜为人知的黑科技网站,强大到不敢想象

    如今的网站是越来越多,但许多黑科技网站却是不为人知,其实现在的网站都跟APP的功能相似,甚至许多好网站会比APP的作用更强更全面.今儿给亲们分享五款黑科技网站,是我自己一直私藏的网站,真的是既强大又实 ...

  3. 【收藏】10个高能黑科技网站

    声明 本文转载收藏,原文链接:10个不为人知的黑科技网站,每个都值得你去收藏 - 简书 喷子自重,谢谢! 1: 206云解析 https://206dy.com/ 206云解析是一个实用的视频解析网站 ...

  4. 推荐几个不错的黑科技网站

    推荐10个你可能都需要的站点,每一个都是我在用的,非常的不错,下面我也简单的给每个网站做一个简单的介绍,方便大家使用! 优品PPT 一个完全免费的PPT素材下载网站,在这个网站连注册登录都不需要,找到 ...

  5. 12个黑科技网站,每个都是十分良心了 zt – 步行街主干道 – 虎扑社区

    文章目录[隐藏] 12个黑科技网站,每个都是十分良心了 zt 社区 » 步行街 » 步行街主干道 12个黑科技网站,每个都是十分良心了 zt 972回复 /26亮  366618 浏览 1234567 ...

  6. 9个不为人知的黑科技网站,每一个都强大到无敌!

    除了百度和谷歌,大家知道哪些资源丰富的搜索网站呢?下面就给大家分享9个不为人知的黑科技网站,其搜索效率不比百度和谷歌差哦,不信可以去试试. 1:西林街搜索 http://www.xilinjie.co ...

  7. 黑科技网站第三弹 怀旧游戏集锦

    大家好,这里是狐狸的推荐系列之黑科技网站集锦 .我将定期为您推送一些有趣的.富有科技感的.知识聚合的网站,帮助大家更立体更多面地看待这个世界

  8. 5个能让你15T硬盘立马爆满的黑科技网站,让你在工作中技高一筹

    职场当中你还在默默无闻了工作嘛?那你就很难有升职加薪的机会了,一般老板喜欢能办事情的员工,如果老板交代下去的一件事情,别人花1小时,或许你就只用了10分钟搞定了,这时老板就你就另眼想看了,那么在职场当 ...

  9. 6个不可多得的黑科技网站,让你在办公中如有神助,请低调收藏

    其实在职场办公当中想要提升自己的工作效率,就必须得使用几个工具来帮助自己,网上这种类型的工具网站其实有很多,不仅能够在里面找到你需要的素材,还可以帮助你处理一些文件以及图片设计什么的,下面就带大家看看 ...

最新文章

  1. Laravel框架中的event事件操作
  2. 皮一皮:原来网恋就是这个感觉...
  3. 内存资源的申请与释放(CC++)
  4. 关于css的基础知识点
  5. 【Pytorch神经网络实战案例】26 MaskR-CNN内置模型实现目标检测
  6. Google浏览器开发者工具:CSSViewer(一个Css查看器)
  7. 随想录(matlab学习)
  8. mybatis 复习笔记03
  9. Python 处理分析 128 张 Excel 表格竟不到3秒?| 附数据集
  10. EF Core 的Startup配置自动创建数据库
  11. 二:C#对象、集合、DataTable与Json内容互转示例;
  12. iis7网站可用php吗,在IIS7下面添加对PHP网页的支持
  13. 文件传输工具rzsz
  14. 小程序colorui引入与使用
  15. 取出字符串中数字的最大值
  16. 计算机通过网线连接不到网络,电脑有网线连不上网怎么解决
  17. 树莓派3B+安装Raspbian简易教程
  18. 币圈人警惕!5大错误足以摧毁你的一切
  19. Python图像处理丨图像的灰度线性变换
  20. 千层套路“千层饼”,论面试中的套路与反套路

热门文章

  1. 内核ko模块strip使用
  2. 几种并发服务器模型的实现:多线程,多进程,select,poll,epoll
  3. leetcode(一)刷题两数之和
  4. Java开发知识体系!我用2个月的时间破茧成蝶
  5. java生成pdf工具类,聪明人已经收藏了!
  6. Java-进阶:多线程2
  7. 普通二本的辛酸Android面试之路,算法太TM重要了
  8. 阿里P8亲自教你!Activity的6大难点,你会几个?年薪50W
  9. 提高SQL执行性能方案:如何让你的SQL运行得更快zt
  10. ecshop 前台个人中心修改侧边栏 和 侧边栏显示不全 或 导航现实不全