熊猫tv新功能介绍

Out of all technologies that is introduced in Data Analysis, Pandas is one of the most popular and widely used library.

在Data Analysis引入的所有技术中,P andas是最受欢迎和使用最广泛的库之一。

So what are we going to cover :

那么我们要讲的是:

  1. Installation of pandas熊猫的安装
  2. Key components of pandas大熊猫的主要成分
  3. Read/Import data from CSV file从CSV文件读取/导入数据
  4. Write/Export data to CSV files将数据写入/导出到CSV文件
  5. Viewing and selecting data查看和选择数据

1.安装熊猫 (1. Installation of pandas)

Let’s take care of the boring but important stuff first. Setting up the space to work with pandas.

首先让我们处理无聊但重要的事情。 设置与熊猫共处的空间。

If you are using conda as your environment with miniconda or Anaconda then:

如果您使用的 畅达 miniconda Python 那么 你的环境

  • Activate your environment激活您的环境

conda activate ./env

conda激活./env

  • Install pandas package安装熊猫包

conda install pandas

conda安装熊猫

If you are using virtual environment with virtualenv then :

如果您通过virtualenv使用虚拟环境,则:

  • Activate your environment激活您的环境

source ./env/bin/activate

源./env/bin/activate

  • Install pandas package安装熊猫包

pip install pandas

点安装熊猫

If you are using virtual environment with pipenv then :

如果您通过pipenv使用虚拟环境,则:

  • create and environment and install pandas in that environment在该环境中创建和环境并安装熊猫

pipenv install pandas

pipenv安装熊猫

  • Activate the environment激活环境

pipenv shell

皮壳

2.大熊猫的主要成分 (2. Key components of pandas)

Pandas provides two compound data types, which are the key components of pandas that gives us so much flexibility on selecting, viewing and manipulating the data. Those two key components are:

熊猫提供了两种复合数据类型,它们是熊猫的关键组成部分,这使我们在选择,查看和操作数据方面具有如此大的灵活性。 这两个关键组成部分是:

  • Pandas Series熊猫系列
  • Pandas Data Frame熊猫数据框

熊猫系列 (Pandas Series)

It is an one dimensional array offered by pandas. It can store different types of data ( meaning int,string, float, boolean etc..)

它是熊猫提供的一维数组。 它可以存储不同类型的数据(表示int,string,float,boolean等。)

A pandas series data be created as:

将熊猫系列数据创建为:

import pandas as pd

将熊猫作为pd导入

student_pass_percentage_in_country = pd.Series([“90”, “67”, “85”])

student_pass_percentage_in_country = pd.Series([“ 90”,“ 67”,“ 85”])

countries = pd.Series([“India”, “USA”, “China”])

国家= pd.Series([“印度”,“美国”,“中国”])

熊猫数据框 (Pandas Data Frame)

It is the one where most of the magic happens. It is a two dimensional array , you can think of it as an excel sheet.

这是大多数魔术发生的地方。 它是一个二维数组,您可以将其视为Excel工作表。

  • The index in pandas starts from 0.熊猫的索引从0开始。
  • The row is referred as axis=1 and column as axis=0.该行称为axis = 1,而列称为axis = 0。
  • Its first column represents the index.它的第一列代表索引。
  • More then one row can be associated with one index. So there are two ways of looking for data: one by index, one by position. Position also starts from 0.多于一行可以与一个索引相关联。 因此,有两种查找数据的方法:一种是按索引,一种是按位置。 位置也从0开始。

A pandas data frame can be created as:

熊猫数据框可以创建为:

student_pass_percent_by_country = pd.DataFrame({ ‘Country’: countries, ‘Pass Percent’: student_pass_percentage_in_country})

student_pass_percent_by_country = pd.DataFrame({'Country':国家,'Pass Percent':student_pass_percentage_in_country})

3.从CSV文件读取/导入数据 (3. Read / import data from CSV file)

First lets see how CSV file data looks like.

首先,让我们看看CSV文件数据的外观。

A CSV file contains data in comma separated format, which looks like:

CSV文件包含逗号分隔格式的数据,如下所示:

It looks like an excel sheet if you view on any excel viewer
如果您在任何excel查看器上查看,它看起来像一个excel工作表
This is how it is in its raw format, when opened in any editor , in this i have opened in VS Coded
在任何编辑器中打开时,它都是原始格式,在VS Coded中已打开

Reading CSV data is very straight forward in pandas. It provides you two functions : read_csv(‘file_path’) or read_csv(‘file_url’) , the data gets stored in data frame.

在熊猫中,读取CSV数据非常简单。 它提供了两个功能:read_csv('file_path')或read_csv('file_url'),数据被存储在数据框中。

i have taken this public repository from curran, so that you can use it as well.

我已经从curran那里获取了这个公共存储库,以便您也可以使用它。

csv_data = pd.read_csv(‘https://github.com/curran/data/blob/gh-pages/indiaGovOpenData/All_India_Index-February2016.csv’)

csv_data = pd.read_csv(' https://github.com/curran/data/blob/gh-pages/indiaGovOpenData/All_India_Index-February2016.csv ')

As you can see it right away tells us how many rows and columns are there in the data.

如您所见,它立即告诉我们数据中有多少行和多少列。

4.将数据写入/导出到CSV文件 (4. Write/Export data to CSV files)

Exporting data to CSV file is as simple as importing it. Pandas has a function called : to_csv(‘file_name’), this will export the data from a data frame to CSV file.

将数据导出到CSV文件就像导入数据一样简单。 熊猫有一个名为:to_csv('file_name')的函数,它将数据从数据帧导出到CSV文件。

csv_data.to_csv(‘new_exported_data.csv;’)

csv_data.to_csv('new_exported_data.csv;')

5.查看和选择数据 (5. Viewing and Selecting data)

As we get to work with a lot of data so if we can view and select the data the way we want, it can give us more insights on the data at the first place.

当我们开始处理大量数据时,如果我们可以按照自己的方式查看和选择数据,那么它首先可以为我们提供关于数据的更多见解。

To view a snippet of data , ( 5 rows by default ):

要查看数据片段,(默认为5行):

csv_data.head()

csv_data.head()

To view more then just 5 records, let’s say you want to see 23 records from the top:

要查看仅5条记录,假设您要从顶部查看23条记录:

csv_data.head(23)

csv_data.head(23)

To view a snippet of data from bottom:

要从底部查看数据片段:

csv_data.tail()

csv_data.tail()

To view more then just 5 records from bottom, let’s say you want to see 11 records from the bottom:

要从底部仅查看5条记录,假设您要从底部查看11条记录:

csv_data.tail(11)

csv_data.tail(11)

To list out all the columns in the data:

列出数据中的所有列:

csv_data.columns

csv_data.columns

In pandas dataframe we can assign more then one data in an index. and the index starts from 0.

在pandas数据框中,我们可以在一个索引中分配多个数据。 索引从0开始。

sample_data = pd.DataFrame({‘name’: [‘Arun’, ‘Shiva’, ‘Rafah’], ‘age’: [12, 34, 45]}, index=[1, 1, 2])

sample_data = pd.DataFrame({'name':['Arun','Shiva','Rafah'],'age':[12,34,45]},index = [1,1,2])

One thing you have noticed above is that , i can create data frame from plan python lists as well.

您在上面注意到的一件事是,我也可以从计划python列表创建数据框。

View data at index 3:

查看索引3的数据:

sample_data.loc[1]

sample_data.loc [1]

View data at position 3:

查看位置3的数据:

sample_data.iloc[1]

sample_data.iloc [1]

Selecting a column , you can select a column in two ways

选择列,您可以通过两种方式选择列

a. Dot notation:

一个。 点表示法:

sample_data.age

sample_data.age

b. Index/Attribute notation:

b。 索引/属性符号:

sample_data[‘age’]

sample_data ['age']

The first option (a) will not work if the column name has spaces. So select one and stick to that.

如果列名包含空格,则第一个选项(a)将不起作用。 因此,选择一个并坚持下去。

Selecting only those data where age is greater than 20:

仅选择年龄大于20的那些数据:

sample_data[sample_data[‘age’] > 20]

sample_data [sample_data ['age']> 20]

I have just listed only most used functions here. I am planning to keep updating the article as i am going to refer it as well if i forget anything. If you have any questions or want to discuss any project feel free to comment here.

我在这里只列出了最常用的功能。 我打算继续更新文章,因为如果我忘记了任何内容,我也会参考它。 如果您有任何疑问或想要讨论任何项目,请在此处发表评论。

Thank you for reading :)

谢谢您的阅读:)

翻译自: https://medium.com/@lax_17478/data-analysis-a-complete-introduction-to-pandas-part-1-3dd06922144a

熊猫tv新功能介绍


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

相关文章:

  • matlab界area_Matlab的数据科学界
  • hdf5文件和csv的区别_使用HDF5文件并创建CSV文件
  • 机器学习常用模型:决策树_fairmodels:让我们与有偏见的机器学习模型作斗争
  • 100米队伍,从队伍后到前_我们的队伍
  • mongodb数据可视化_使用MongoDB实时可视化开放数据
  • Python:在Pandas数据框中查找缺失值
  • Tableau Desktop认证:为什么要关心以及如何通过
  • js值的拷贝和值的引用_到达P值的底部:直观的解释
  • struts实现分页_在TensorFlow中实现点Struts
  • 钉钉设置jira机器人_这是当您机器学习JIRA票证时发生的事情
  • 小程序点击地图气泡获取气泡_气泡上的气泡
  • PopTheBubble —测量媒体偏差的产品创意
  • 面向Tableau开发人员的Python简要介绍(第3部分)
  • pymc3使用_使用PyMC3了解飞机事故趋势
  • 吴恩达神经网络1-2-2_图神经网络进行药物发现-第2部分
  • 数据图表可视化_数据可视化十大最有用的图表
  • 接facebook广告_Facebook广告分析
  • eda可视化_5用于探索性数据分析(EDA)的高级可视化
  • css跑道_如何不超出跑道:计划种子的简单方法
  • 熊猫数据集_为数据科学拆箱熊猫
  • matplotlib可视化_使用Matplotlib改善可视化设计的5个魔术技巧
  • 感知器 机器学习_机器学习感知器实现
  • 快速排序简便记_建立和测试股票交易策略的快速简便方法
  • 美剧迷失_迷失(机器)翻译
  • 我如何预测10场英超联赛的确切结果
  • 深度学习数据自动编码器_如何学习数据科学编码
  • 图深度学习-第1部分
  • 项目经济规模的估算方法_估算英国退欧的经济影响
  • 机器学习 量子_量子机器学习:神经网络学习
  • 爬虫神经网络_股市筛选和分析:在投资中使用网络爬虫,神经网络和回归分析...

熊猫tv新功能介绍_熊猫简单介绍相关推荐

  1. 熊猫tv新功能介绍_您应该知道的4种熊猫绘图功能

    熊猫tv新功能介绍 Pandas is a powerful package for data scientists. There are many reasons we use Pandas, e. ...

  2. 支付宝可以给微信好友转账了?这项新功能体验没那么简单

    导读:阿里.腾讯两大生态何时能打通? 作者 | 第一财经 亓宁 日前,不少网友发现了支付宝的一项新功能:向微信好友转账. 这一话题在10月16日一度登上微博热搜,不过不少人亲自体验后表示,这个功能&q ...

  3. hadoop简单介绍_Hadoop:简单介绍

    hadoop简单介绍 什么是Hadoop: Hadoop是用Java编写的框架,用于在大型商品硬件群集上运行应用程序,并具有类似于Google File System和MapReduce的功能 . H ...

  4. matlab软件的介绍,MATLAB软件简单介绍.ppt

    MATLAB软件简单介绍 MATLAB是建立在向量.数组和矩阵基础上的一种分析和仿真工具软件包: 同时提供了编程计算的功能,通过编程可以解决一些复杂的工程问题: 也可绘制二维.三维图形,输出结果可视化 ...

  5. ES6 对象的新功能与解构赋值介绍

    ES6 通过字面量语法扩展.新增方法.改进原型等多种方式加强对象的使用,并通过解构简化对象的数据提取过程. 一.字面量语法扩展 在 ES6 模式下使用字面量创建对象更加简洁,对于对象属性来说,属性初始 ...

  6. app常见功能模块及其使用简单介绍

    app特有功能:版本更新 欢迎界面 消息推送 三方登录  一 版本更新--每次登录监测,进行提示      氛围强制更新和非强制更新,常见的都是非强制更新,赤兔属于强制更新 欢迎页面--最常见的功能 ...

  7. 新颖的自我介绍_精选简单新颖的自我介绍

    精选简单新颖的自我介绍 简单新颖的自我介绍(一): 大家好!我是xx,今年xx岁,毕业于xx校园,我的爱好xx,很高兴和大家一齐共事,望大家多多指导,如今后在工作有做的不到的地方请大家多多包涵.等等! ...

  8. python怎么使用数据库系统有什么好处_数据库简单介绍

    出处: https://www.cnblogs.com/lizhengtao/p/9990972.html 1.MySQL常见数据库引擎及比较? InnoDB:支持事务处理,支持外键,支持崩溃修复能力 ...

  9. python关键字中文意思_中英文简单介绍Python关键字 -- Python Key Words

    直奔主题,理解Python关键字有利于正确理解Python中的命令,对于系统掌握Python语法有着十分重要的作用. 1, False : Boolean Value as no 2, True : ...

最新文章

  1. python调用shell命令-Python调用shell命令常用方法(4种)
  2. 开发实习生做什么_实习生月薪6W,还有住房补贴!投行前台到底是做什么的?...
  3. 关于创建主键和索引的关系一个小小測试
  4. php商品分类显示商品,ecshop首页显示全部商品分类的方法
  5. Local Binary Convolutional Neural Networks ---卷积深度网络移植到嵌入式设备上?
  6. 《Windows核心编程》学习笔记(9)– 在win7或者vista系统下提升一个进程的运行权限...
  7. assignment symbolic automaton verilog设计
  8. 复制文本朗读_原创:昭明文选配乐朗读 卷第五十一 论一 东方曼倩 非有先生论 王子渊 四子讲德论 并序...
  9. vue 第四天 (计算属性的使用)
  10. 将MSHFlexGrid1中记录导出为Excel
  11. 怎样下载Dev-C++
  12. 如何用计算机计算平均温差,换热器传热计算的平均温差法.PPT
  13. 使用rpm 安装wget
  14. 个人随笔/小白应该如何学习Linux,我的一些心得分享.
  15. Java ArrayList集合案例(上课笔记)
  16. ArcEngine符号化——点密度符号
  17. unity实现简单游戏——井字棋
  18. 京东面试详解(渣渣吐血整理版)
  19. 矩阵树定理--luoguP4208 [JSOI2008]最小生成树计数
  20. C#数据库四种执行方法(ExecuteNonQuery)

热门文章

  1. 详谈P(查准率),R(查全率),F1值
  2. 腾讯云AI应用产品总监王磊:AI 在传统产业的最佳实践
  3. vue.js 安装
  4. 几种机器学习算法的优缺点
  5. 微信小程序把玩(三十三)Record API
  6. ASP.NET 对类进行XML序列化和反序列化
  7. C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
  8. 中国直销未来三五年的发展趋势[转]
  9. ionic最新安装教程
  10. unity如何让物体与特定物体之间不发生碰撞