Skip to Content
Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
book

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

by Jake VanderPlas, 菊池 彰
February 2024
Intermediate to advanced
576 pages
9h 17m
Japanese
O'Reilly Japan, Inc.
Content preview from Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

20章集約とグループ化

効率的な要約は、多くのデータ分析作業における基本です。すなわち、巨大なデータセットの何らかの側面を1つの値で表すsum(合計)、mean(平均値)、median(中央値)、min(最小値)、max(最大値)などの集約値の計算です。この章では、NumPy配列で行った単純な操作から、groupbyの概念に基づくより洗練された操作まで、pandasの集約について説明します。

便宜上、前の章で使用したDisplayクラスを再利用します。

In [1]: import numpy as np
        import pandas as pd

        class Display:
            """HTML表現で複数オブジェクトを表示する"""
            template = """<div style="float: left; padding: 10px;">
            <p style='font-family:"Courier New", Courier, monospace'>{0}{1}
            """
            def __init__(self, *args):
                self.args = args

            def _repr_html_(self):
                return '\n'.join(self.template.format(a, eval(a)._repr_html_())
                                 for a in self.args)

            def __repr__(self):
                return '\n\n'.join(a + '\n' + repr(eval(a))
                                   for a in self.args)

20.1 惑星(planets)データ

ここでは、seabornパッケージ(https://seaborn.pydata.org/)の一部として入手できるplanetsデータセットを使用します( ...

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.
Start your free trial

You might also like

Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Jake VanderPlas, 菊池 彰
推薦システム実践入門 ―仕事で使える導入ガイド

推薦システム実践入門 ―仕事で使える導入ガイド

風間 正弘, 飯塚 洸二郎, 松村 優也
プロダクトマネージャーのしごと 第2版 ―1日目から使える実践ガイド

プロダクトマネージャーのしごと 第2版 ―1日目から使える実践ガイド

Matt LeMay, 永瀬 美穂, 吉羽 龍太郎, 原田 騎郎, 高橋 一貴

Publisher Resources

ISBN: 9784814400638Publisher Website