熊猫分发

For those just starting out in data science, the Python programming language is a pre-requisite to learning data science so if you aren’t familiar with Python go make yourself familiar and then come back here to start on Pandas.

对于刚接触数据科学的人来说,Python编程语言是学习数据科学的先决条件,因此,如果您不熟悉Python,请先熟悉一下,然后再回到这里开始学习Pandas。

You can start learning Python with a series of articles I just started called Minimal Python Required for Data Science.

您可以从我刚刚开始的一系列文章开始学习Python,这些文章称为“数据科学所需的最小Python” 。

One of the most important tools in the toolbox when it comes to data science is pandas which is a data analytics library for Python developed by Wes McKinney during his tenure at a hedge fund.

关于数据科学,工具箱中最重要的工具之一是pandas,这是Wes McKinney在对冲基金任职期间开发的Python数据分析库。

For this entire series of articles, we’re going to be using Anaconda which is a fancy Python package manager geared for data science and machine learning. If you aren’t familiar with what I just talked about go ahead and check out this video which will teach you about Anaconda and Jupyter Notebook which is central to data science work.

在整个系列文章中,我们将使用Anaconda ,这是一款专为数据科学和机器学习而设计的Python软件包管理器。 如果您不熟悉我刚才所说的内容,请观看此视频,该视频将教您有关Anaconda和Jupyter Notebook的知识,这对数据科学工作至关重要。

You can activate your conda environment (virtual environment) with:

您可以使用以下方法激活conda环境( 虚拟环境 ):

$ conda activate [name of environment]# my environment is named `datascience` so$ conda activate datascience

Once you activate your conda virtual environment you should see this on your Terminal:

激活conda虚拟环境后,您应该在终端上看到以下内容:

(datascience)$

Assuming you have miniconda or anaconda installed on your system you can easily install pandas with:

假设您的系统上安装了miniconda或anaconda,则可以使用以下方法轻松安装熊猫:

$ conda install pandas

We’re also going to be using Jupyter Notebook to do our coding so go ahead and

我们还将使用Jupyter Notebook进行编码,因此继续

$ 

And startup your Jupyter Notebook with:

然后使用以下命令启动Jupyter Notebook:

$ jupyter notebook

熊猫是将所有元素粘合在一起的粘合剂 (Pandas is the glue that holds it all together)

Photo by Juhasz Imre from Pexels
Pexels的Juhasz Imre 摄影

Pandas gets more important as we venture higher up the hierarchy of data science into the fields of machine learning as it allows data to be “cleaned” and “wrangled” before getting fed to algorithms like Random Forest and Neural Networks. If ML algorithms are Doc, then pandas is Marty.

随着我们冒险将数据科学的层次结构带入机器学习领域,Pandas变得越来越重要,因为它允许在将数据馈入随机森林和神经网络等算法之前先对其进行“清理”和“整理”。 如果ML算法是Doc,则熊猫是Marty。

导游巴士之旅 (A Guided Bus Tour)

My favorite. Photo by Venkat Ragavan from Pexels
我的最爱。 Pexels的Venkat Ragavan摄

One of my favorite places to visit even since childhood is the San Diego Zoo. And one thing I always do is to take the guided bus tour while drinking a Blue Moon.

即使从小我最喜欢去的地方之一是圣地亚哥动物园。 我一直要做的一件事就是在喝着“蓝月亮”的同时进行有导游的游览。

We’re going to do something similar in that I’m going to give a brief tour of just some of the things you can do with Pandas. You’re on your own with the Blue Moon.

我们将做类似的事情,简要介绍一下您可以使用Pandas进行的一些操作。 蓝月亮让你自己。

Both the data and the inspiration for this medium series come from Ted Petrou’s excellent courses on Dunder Data.

该媒体系列的数据和灵感均来自Ted Petrou的Dunder Data精品课程。

Pandas essentially deals with tabular data: rows and columns. In this respect it’s very much like an Excel spreadsheet.

熊猫本质上处理表格数据:行和列。 在这方面,它非常类似于Excel电子表格。

The two primary objects you’ll interface with in pandas is the Series and the DataFrame. A DataFrame is two-dimensional data complete with rows and columns.

您将在熊猫中使用的两个主要对象是SeriesDataFrame 。 DataFrame是具有行和列的二维数据。

It’s okay if you don’t know what the below code does we will go over it later in detail. The data that we use here concerns bicycle riders in the city of Chicago, Illnoise.

没关系,如果您不知道下面的代码是什么,我们稍后将详细介绍它。 我们在此使用的数据与伊利诺伊斯州芝加哥市的自行车骑手有关。

DataFrame: tabular data
DataFrame:表格数据

Series is one-dimensional data or a single column of data with respect to a DataFrame:

系列是相对于DataFrame的一维数据或单列数据:

Series: A single column of data
系列:单列数据

As shown above one of the highlights of pandas is that it allows data to be loaded into a Jupyter Notebook session from whatever the source file is whether it’s a CSV (comma delimited), XLSX(Excel), SQL, or JSON.

如上所示,pandas的亮点之一是它允许将数据从任何源文件加载到Jupyter Notebook会话中,无论源文件是CSV(逗号分隔),XLSX(Excel),SQL还是JSON。

One of the first things we always do is take a peek at the dataset we’re studying by using the head method. By default head will present the first five rows of the data. We can pass an integer to control how many rows we want to see:

我们经常要做的第一件事就是使用head方法窥视我们正在研究的数据集。 默认情况下, head将显示数据的前五行。 我们可以传递一个整数来控制我们要查看的行数:

df.head(7)
First seven rows
前七行

If we want to see the last five rows:

如果要查看最后五行:

df.tail()

读入数据 (Read In Data)

We use the read_csv function to load CSV formatted data.

我们使用read_csv函数加载CSV格式的数据。

We pass the path to the file containing our data as a string to the read_csv method of pandas. In my case, I’m using the url of my GitHub Repo which holds all the data that I will be using. I highly recommend reading the documentation regarding pandas read_csv function as it’s one of the most important and dynamic functions within the whole library.

我们将包含数据的文件的路径作为字符串传递给read_csv方法。 就我而言,我使用的是GitHub Repo的网址,该网址包含我将要使用的所有数据。 我强烈建议阅读有关pandas read_csv函数的文档 ,因为它是整个库中最重要且最动态的函数之一。

筛选资料 (Filter Data)

We can filter rows of a pandas DataFrame with conditional logic. For programmers familiar with SQL this would be like using the WHERE clause.

我们可以使用条件逻辑过滤熊猫DataFrame的行。 对于熟悉SQL的程序员,这就像使用WHERE子句。

To retrieve only the rows where wind_speed is greater than 42.0 we can do this:

要仅检索wind_speed大于42.0的行,我们可以这样做:

the filt variable stands for ‘filter’
filt变量代表“过滤器”

We can filter for more than one condition like this:

我们可以过滤多个条件,例如:

Here we filter for the condition where the wind speed is greater than 42.0 (I’m assuming miles per hour) and where the gender of the bicyclist is female. As we can see it returns an empty dataset.

在这里,我们筛选出风速大于42.0(我假设每小时英里)并且骑自行车的性别是女性的情况。 如我们所见,它返回一个空的数据集。

We can verify that we’re not committing some kind of error that results in an empty query by trying out the same multiple filters but for male riders.

我们可以通过尝试相同的多个过滤器(但针对男性骑手)来验证是否未犯导致空查询的错误。

We can also do something like this:

我们还可以这样做:

查询:过滤的一种更简单的选择 (Query: A Simpler Alternative to Filtering)

Pandas also has a query method which is somewhat limited in its abilities, but allows for simpler and more readable code. Just as before, programmers familiar with SQL should feel comfortable with this method.

熊猫还具有一种query方法,该query方法的功能受到一定程度的限制,但允许使用更简单和更具可读性的代码。 和以前一样,熟悉SQL的程序员应该对此方法感到满意。

未完待续 (To Be Continued)

Pandas for Newbies is meant to be a Medium series so watch for the next upcoming tutorial Pandas for Newbies: An Introduction Part II which will be posted soon.

《 Pandas for Newbies》是一个中级系列,因此请关注下一个即将发布的教程《 Pandas for Newbies:Introduction Part II》

我做的事 (What I do)

I help people find Mentors, Code in Python, and Write about Life. If you’re thinking about switching careers into the tech industry or just want to talk you can sign up for my Slack Channel via VegasBlu.

我帮助人们找到导师,Python代码并撰写关于生活的文章。 如果您正在考虑将职业转向科技行业,或者只是想谈谈,可以通过VegasBlu注册我的Slack频道。

翻译自: https://towardsdatascience.com/pandas-for-newbies-an-introduction-part-i-8246f14efcca

熊猫分发


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

相关文章:

  • 队列的链式存储结构及其实现_了解队列数据结构及其实现
  • 水文分析提取河网_基于图的河网段地理信息分析排序算法
  • python 交互式流程图_使用Python创建漂亮的交互式和弦图
  • 最接近原点的 k 个点_第K个最接近原点的位置
  • 熊猫分发_熊猫新手:第二部分
  • 数据分析 绩效_如何在绩效改善中使用数据分析
  • 您一直在寻找5+个简单的一线工具来提升Python可视化效果
  • 产品观念:更好的捕鼠器_故事很重要:为什么您需要成为更好的讲故事的人
  • 面向Tableau开发人员的Python简要介绍(第2部分)
  • netflix_Netflix的计算因果推论
  • 高斯金字塔 拉普拉斯金字塔_金字塔学入门指南
  • 语言认知偏差_我们的认知偏差正在破坏患者的结果数据
  • python中定义数据结构_Python中的数据结构。
  • plotly django_使用Plotly为Django HTML页面进行漂亮的可视化
  • 软件工程方法学要素含义_日期时间数据的要素工程
  • 数据湖 data lake_在Data Lake中高效更新TB级数据的模式
  • ai对话机器人实现方案_显然地引入了AI —无代码机器学习解决方案
  • 图片中的暖色或冷色滤色片是否会带来更多点击? —机器学习A / B测试
  • 图卷积 节点分类_在节点分类任务上训练图卷积网络
  • 回归分析预测_使用回归分析预测心脏病。
  • aws spark_使用Spark构建AWS数据湖时的一些问题以及如何处理这些问题
  • 数据科学家编程能力需要多好_我们不需要这么多的数据科学家
  • sql优化技巧_使用这些查询优化技巧成为SQL向导
  • 物种分布模型_减少物种分布建模中的空间自相关
  • 清洁数据ploy n_清洁屋数据
  • 基于边缘计算的实时绩效_基于绩效的营销中的三大错误
  • 上凸包和下凸包_使用凸包聚类
  • 决策树有框架吗_决策框架
  • mysql那本书适合初学者_3本书适合初学者
  • 阎焱多少身价_2020年,数据科学家的身价是多少?

熊猫分发_熊猫新手:第一部分相关推荐

  1. 熊猫分发_熊猫cut()函数示例

    熊猫分发 1.熊猫cut()函数 (1. Pandas cut() Function) Pandas cut() function is used to segregate array element ...

  2. 熊猫分发_熊猫新手:第二部分

    熊猫分发 This article is a continuation of a previous article which kick-started the journey to learning ...

  3. 熊猫分发_熊猫实用指南

    熊猫分发 什么是熊猫? (What is Pandas?) Pandas is an open-source data analysis and manipulation tool for Pytho ...

  4. 熊猫分发_熊猫重命名列和索引

    熊猫分发 Sometimes we want to rename columns and indexes in the Pandas DataFrame object. We can use pand ...

  5. 熊猫分发_熊猫下降列和行

    熊猫分发 1. Pandas drop()函数语法 (1. Pandas drop() Function Syntax) Pandas DataFrame drop() function allows ...

  6. 熊猫分发_与熊猫度假

    熊猫分发 While working on a project recently, I had to work with time series data spread over a year. I ...

  7. 熊猫数据集_熊猫迈向数据科学的第一步

    熊猫数据集 I started learning Data Science like everyone else by creating my first model using some machi ...

  8. 熊猫分发_实用熊猫指南

    熊猫分发 Pandas is a very powerful and versatile Python data analysis library that expedites the data an ...

  9. 熊猫分发_流利的熊猫

    熊猫分发 Let's uncover the practical details of Pandas' Series, DataFrame, and Panel 让我们揭露Pandas系列,DataF ...

最新文章

  1. Opencv4.0运行yolov3
  2. mysql in边界_mysql中 where in 用法详解
  3. 线程组名称_Netty在Dubbo中的线程名称
  4. RESTful架构风格
  5. 【杂谈】有三AI知识星球一周年了!为什么公众号+星球才是完整的?
  6. wxWidgets:wxStreamToTextRedirector类用法
  7. 跟小静读《jQuery权威指南》——目录
  8. querywrapper 时间区间查询_雅思官方:关于增设用于英国签证及移民的雅思考试考点的通知!附20192020雅思考试时间安排...
  9. python索引例子_Python实现带下标索引的遍历操作示例
  10. linux 加密工具办法
  11. jmeter压力测试linux,JMeter压力测试
  12. Java八种基本数据类型的大小,以及封装类,自动装箱/拆箱的用法?
  13. 『ORACLE』SPM(下)-baseline实验(11g)
  14. 科比职业生涯数据集分析
  15. Cox模型中的时间依存协变量和时间依存系数(R语言)第二部分
  16. 172Echarts - 象形柱图(Dotted bar)
  17. MuseScore入门教程(一、下载,并新建乐谱)
  18. FPGA电子设计系统的资源优化(面积优化)与速度优化
  19. RHEL-UEFI引导恢复规范
  20. IPFS在Ubuntu中的安装步骤

热门文章

  1. c++中的异常--1(基本概念, c语言中处理异常,c++中处理异常,异常的基本使用,栈解旋)
  2. Eclipse : Unresolved inclusion
  3. #ifdef __cplusplus extern “C”的作用详解
  4. static in c language
  5. 897. 递增顺序查找树
  6. Java面试题库,java核心技术第十版下载
  7. Laravel 除了首页能正常访问,其它页面均404
  8. redis的源码编译安装+发布订阅+RDB持久化
  9. OpenGL中的二维编程——从简单的矩形开始
  10. iOS之由身份证号返回性别