《Python数据分析技术栈》第06章使用 Pandas 准备数据 01 Pandas概览(Pandas at a glance)

这篇具有很好参考价值的文章主要介绍了《Python数据分析技术栈》第06章使用 Pandas 准备数据 01 Pandas概览(Pandas at a glance)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

01 Pandas概览(Pandas at a glance)

《Python数据分析技术栈》第06章使用 Pandas 准备数据 01 Pandas概览(Pandas at a glance)

Pandas概述

Wes McKinney developed the Pandas library in 2008. The name (Pandas) comes from the term “Panel Data” used in econometrics for analyzing time-series data. Pandas has many features, listed in the following, that make it a popular tool for data wrangling and analysis.

Wes McKinney 于 2008 年开发了 Pandas 库。Pandas 这个名字来源于计量经济学中用于分析时间序列数据的术语 “面板数据”。Pandas 有许多功能,这些功能使其成为数据处理和分析的常用工具。

Pandas provides features for labeling of data or indexing, which speeds up the retrieval of data.

Pandas 提供数据标签或索引功能,可加快数据检索速度。

Input and output support: Pandas provides options to read data from different file formats like JSON (JavaScript Object Notation), CSV (Comma-Separated Values), Excel, and HDF5 (Hierarchical Data Format Version 5). It can also be used to write data into databases, web services, and so on.

输入和输出支持: Pandas 提供从不同文件格式读取数据的选项,如 JSON(JavaScript Object Notation)、CSV(Comma-Separated Values)、Excel 和 HDF5(Hierarchical Data Format Version 5)。它还可用于将数据写入数据库、网络服务等。

Most of the data that is needed for analysis is not contained in a single source, and we often need to combine datasets to consolidate the data that we need for analysis. Again, Pandas comes to the rescue with tailor-made functions to combine data.

分析所需的大部分数据并不包含在单一来源中,因此我们经常需要合并数据集,以整合分析所需的数据。Pandas 又一次提供了量身定制的合并数据函数。

Speed and enhanced performance: The Pandas library is based on Cython, which combines the convenience and ease of use of Python with the speed of the C language. Cython helps to optimize performance and reduce overheads.

速度和增强的性能 Pandas 库基于 Cython,它将 Python 的方便易用与 C 语言的速度相结合。Cython 有助于优化性能和减少开销。

Data visualization: To derive insights from the data and make it presentable to the audience, viewing data using visual means is crucial, and Pandas provides a lot of built-in visualization tools using Matplotlib as the base library.

数据可视化: 要从数据中获得洞察力并将其呈现给受众,使用可视化手段查看数据至关重要,而 Pandas 使用 Matplotlib 作为基础库,提供了大量内置可视化工具。

Support for other libraries: Pandas integrates smoothly with other libraries like Numpy, Matplotlib, Scipy, and Scikit-learn. Thus we can perform other tasks like numerical computations, visualizations, statistical analysis, and machine learning in conjunction with data manipulation.

支持其他库 Pandas 可与 Numpy、Matplotlib、Scipy 和 Scikit-learn 等其他库顺利集成。因此,我们可以结合数据处理执行其他任务,如数值计算、可视化、统计分析和机器学习。

Grouping: Pandas provides support for the split-apply-combine methodology, whereby we can group our data into categories, apply separate functions on them, and combine the results.

分组: Pandas 支持 "拆分-应用-合并 "方法,我们可以将数据分组,分别应用不同的函数,然后合并结果。

Handling missing data, duplicates, and filler characters: Data often has missing values, duplicates, blank spaces, special characters (like $, &), and so on that may need to be removed or replaced. With the functions provided in Pandas, you can handle such anomalies with ease.

处理缺失数据、重复数据和填充字符: 数据中经常会有需要删除或替换的缺失值、重复数据、空白、特殊字符(如 $、&)等。利用 Pandas 提供的函数,您可以轻松处理此类异常情况。

Mathematical operations: Many numerical operations and computations can be performed in Pandas, with NumPy being used at the back end for this purpose.

数学运算 在 Pandas 中可以执行许多数值运算和计算,NumPy 在后端用于此目的。

环境准备

If you have not already installed Pandas, go to the Anaconda Prompt and enter the following command.

如果尚未安装 Pandas,请转到 Anaconda 提示符并输入以下命令。

pip install pandas

Once the Pandas library is installed, you need to import it before using its functions. In your Jupyter notebook, type the following to import this library.

安装好 Pandas 库后,在使用其功能之前需要将其导入。在 Jupyter 笔记本中,键入以下内容导入该库。

import pandas as pd

Here, pd is a shorthand name or alias that is a standard for Pandas.

这里,pd 是 Pandas 标准的速记名称或别名。

For some of the examples, we also use functions from the NumPy library. Ensure that both the Pandas and NumPy libraries are installed and imported.

在部分示例中,我们还使用了 NumPy 库中的函数。确保已安装并导入 Pandas 和 NumPy 库。

You need to download a dataset, “subset-covid-data.csv”, that contains data about the number of cases and deaths related to the COVID-19 pandemic for various countries on a particular date. Please use the following link for downloading the dataset: https://github.com/DataRepo2019/Data-files/blob/master/subset-covid-data.csv

您需要下载一个名为 "subset-covid-data.csv "的数据集,其中包含特定日期不同国家与 COVID-19 大流行相关的病例数和死亡数的数据。请使用以下链接下载数据集: https://github.com/DataRepo2019/Data-files/blob/master/subset-covid-data.csv文章来源地址https://www.toymoban.com/news/detail-817267.html

到了这里,关于《Python数据分析技术栈》第06章使用 Pandas 准备数据 01 Pandas概览(Pandas at a glance)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Python数据分析:NumPy、Pandas和Matplotlib的使用和实践

    在现代数据分析领域中,Python已成为最受欢迎的编程语言之一。Python通过庞大的社区和出色的库支持,成为了数据科学家和分析师的首选语言。在Python的库中,NumPy、Pandas和Matplotlib是三个最为重要的库,它们分别用于处理数值数组、数据处理和可视化。本文将介绍这三个库的

    2024年02月04日
    浏览(34)
  • Python实战 | 使用 Python 的日志库(logging)和 pandas 库对日志数据进行分析

    专栏集锦,大佬们可以收藏以备不时之需 Spring Cloud实战专栏:https://blog.csdn.net/superdangbo/category_9270827.html Python 实战专栏:https://blog.csdn.net/superdangbo/category_9271194.html Logback 详解专栏:https://blog.csdn.net/superdangbo/category_9271502.html tensorflow专栏:https://blog.csdn.net/superdangbo/category_869

    2024年02月05日
    浏览(35)
  • Python 3 中使用 pandas 和 Jupyter Notebook 进行数据分析和可视化

    简介 Python 的 pandas 包用于数据操作和分析,旨在让您以直观的方式处理带标签或关联数据。 pandas 包提供了电子表格功能,但由于您正在使用 Python,因此它比传统的图形电子表格程序要快得多且更高效。 在本教程中,我们将介绍如何设置一个大型数据集, pandas 的 groupby() 和

    2024年02月19日
    浏览(34)
  • python-数据分析-pandas

    第一种:通过标量创建Series 第二种:通过列表创建Series 第三种:通过字典创建Series 第四种:通过ndarray创建Series values和index 索引和切片 第一种:通过一维列表构成的字典创建DataFrame 姓名 数学 语文 计算机 0 张三 87 54 34 1 李四 45 76 56 2 王五 34 55 77 3 赵六 98 90 87 姓名 数学 语文

    2023年04月23日
    浏览(42)
  • Python数据分析-Pandas

    个人笔迹,建议不看 Series类型 DataFrame类型 是一个二维结构,类似于一张excel表 DateFrame只要求每列的数据类型相同就可以了 查看数据 读取数据及数据操作 行操作 条件选择 缺失值及异常值处理 判断缺失值: 填充缺失值: 删除缺失值 age count 2.000000 mean 1.500000 std 0.707107 min 1

    2024年02月10日
    浏览(39)
  • Python数据分析-数据挖掘(准备数据——数据建模——模型评估——模型应用)

    20 理解业务和数据:我们需要做好什么计划?_哔哩哔哩_bilibili 目录   一、理解业务和数据:我们需要做好什么计划? 1.1两个思想问题 1.2为什么数据挖掘不是万能的 1.3业务背景与目标 1.4把握数据  1.5总结 二、 准备数据:如何处理出完整、干净的数据? 2.1找到数据 2.2数据探索

    2024年02月05日
    浏览(49)
  • 【Python练习】数据分析库Pandas

    1. 了解Serie

    2024年02月09日
    浏览(41)
  • 实战演练Python数据分析[pandas]

    本篇文章出自于《利用Python进行数据分析》示例数据 请结合提供的示例数据,分析代码的功能,并进行数据分析与可视化拓展。本篇文章通过四个例子,通过MoviesLens数据集、美国1880-2010年的婴儿名字、美国农业部视频数据库、2012年联邦选举委员会数据库来进行着重讲解。

    2024年02月15日
    浏览(34)
  • 【头歌】——数据分析与实践-python-Pandas 初体验-Pandas数据取值与选择-Pandas进阶

    第1关 了解数据处理对象–Series 第2关 了解数据处理对象-DataFrame 第3关 读取 CSV 格式数据 第4关 数据的基本操作——排序 第5关 数据的基本操作——删除 第6关 数据的基本操作——算术运算 第7关 数据的基本操作——去重 第8关 数据重塑 第1关 Series数据选择 第2关 DataFrame数据

    2024年01月22日
    浏览(56)
  • python数据分析之Pandas库(一)

    Pandas有两种常用的数据结构: Series (一维数据)与 DataFrame(二维数据)。 Series 是一种类似于 一维数组 的对象,能保存不同数据类型。 DataFrame 是一个 二维的表格型 的数据结构。 1、初始化 使用一位列表初始化Series 2、索引[数据的行标签]、切片 1、初始化 2、查看数据 1、

    2024年02月09日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包