第12章 pandas高级应用
12.1 分类数据
背景和目的
In [10]: import numpy as np; import pandas as pd
In [11]: values = pd.Series(['apple', 'orange', 'apple',
....: 'apple'] * 2)
In [12]: values
Out[12]:
0 apple
1 orange
2 apple
3 apple
4 apple
5 orange
6 apple
7 apple
dtype: object
In [13]: pd.unique(values)
Out[13]: array(['apple', 'orange'], dtype=object)
In [14]: pd.value_counts(values)
Out[14]:
apple 6
orange 2
dtype: int64pandas的分类类型
用分类进行计算
用分类提高性能
分类方法

为建模创建虚拟变量
12.2 GroupBy高级应用
分组转换和“解封”GroupBy
分组的时间重采样
12.3 链式编程技术
管道方法
12.4 总结
Last updated