Skip to Content
Python数据处理
book

Python数据处理

by Jacqueline Kazil, Katharine Jarmul
July 2017
Intermediate to advanced
398 pages
11h 54m
Chinese
Posts & Telecom Press
Content preview from Python数据处理
60
4
4.3
 开始解析
我们解析
Excel
文件用的是
xlrd
库。这个库是用
Python
处理
Excel
文件的一系列库
http://www.python-excel.org/
)之一。
处理
Excel
文件主要有三个库。
xlrd
读取
Excel
文件。
xlwt
Excel
文件写入,并设置格式。
xlutils
一组
Excel
高级操作工具(需要先安装
xlrd
xlwt
)。
在用到这三个库的时候你需要分别安装。但本章只会用到
xlrd
。我们要将
Excel
文件读取
Python
中,所以你先要检查是否安装了
xlrd
pip install xlrd
如果你得到以下错误信息,说明你没有安装
pip
bash: pip: command not found
有关
pip
的安装说明,可以查阅
1.2.4
节,也可以访问
https://pip.pypa.io/en/
latest/installing/
按步骤完成以下内容,即可安装好
Excel
文件的工作环境(也可能是类似的步骤,这和你
的文件组织系统有关)。
(1)
Excel
任务创建一个文件夹。
(2)
创建一个新的
Python
文件,文件名叫
parse_excel.py
,把它放到上面创建的文件夹中。
(3)
从本书仓库(
https://github.com/jackiekazil/data-wrangling
)下载名为
SOWC 2014 Stat
Tables_Table 9.xlsx
Excel
文件,放到同一个文件夹中。
进入这个文件夹,在终端中输入下面的命令,从命令行中运行该脚本: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学中的实用统计学(第2版)

数据科学中的实用统计学(第2版)

Peter Bruce, Andrew Bruce, Peter Gedeck
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez
解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787115459190