Skip to Content
利用 Python 进行数据分析:原书第 3 版
book

利用 Python 进行数据分析:原书第 3 版

by Wes McKinney
November 2023
Intermediate to advanced
512 pages
11h 53m
Chinese
China Machine Press
Content preview from 利用 Python 进行数据分析:原书第 3 版
441
附录 A
高阶 NumPy
在附录
A
中,我会深入讲解
NumPy
库的数组计算,包括关于
ndarray
类型以及更高级的
数组操作和算法的更多内部细节。
该部分包括多个主题,读者不必按顺序阅读。在附录
A
中,我使用 numpy.random 模块
中默认的随机数生成器为许多示例生成了随机数据,如下所示:
A.1 ndarray
对象的内部机理
NumPy
ndarray
提供了一种将同构类型数据块(可以是连续的或步进的)解释为多维
数组对象的方式。数据类型(
dtype
)决定了数据的解释方式,比如浮点数、整数、布尔
值等类型。
ndarray
如此强大,部分原因是所有数组对象都是数据块的步进视图。例如,你可能想知
道数组视图 arr[::2,::-1] 不复制任何数据的原因是什么。简单地说,
ndarray
不只是
一块内存和一个
dtype
,它还有步进信息,这使得数组能以各种步幅在内存中移动。更
准确地讲,
ndarray
内部由以下内容组成:
·
指向数据的指针,数据指内存或内存映射文件中的一块数据。
·
数据类型(dtype),用于描述数组中固定大小的值单元格。
·
表示数组形状的元组。
·
步进元组,其中的整数是指为了前进到当前维度的下一个元素,需要“步进”的字
节数。
A-1
简单模拟了
ndarray
的内部结构。
442
|
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

Effective Python 第3版 ―Pythonプログラムを改良する125項目

Effective Python 第3版 ―Pythonプログラムを改良する125項目

Brett Slatkin, 鈴木 駿

Publisher Resources

ISBN: 9787111726722