python科学计算笔记(六)pandas 分组groupby
来源:互联网 发布:叮当小钟琴软件 编辑:程序博客网 时间:2024/05/19 16:32
pandas.DataFrame.groupby
DataFrame.groupby(by=None, axis=0, level=None, as_index=True, sort=True, group_keys=True, squeeze=False, **kwargs)
Group series using mapper (dict or key function, apply given function to group, return result as series) or by a series of columns.
Parameters:
by : mapping function / list of functions, dict, Series, or tuple /
list of column names. Called on each element of the object index to determine the groups. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups
axis : int, default 0
level : int, level name, or sequence of such, default None
If the axis is a MultiIndex (hierarchical), group by a particular level or levels
as_index : boolean, default True
For aggregated output, return object with group labels as the index. Only relevant for DataFrame input. as_index=False is effectively “SQL-style” grouped output
sort : boolean, default True
Sort group keys. Get better performance by turning this off. Note this does not influence the order of observations within each group. groupby preserves the order of rows within each group.
group_keys : boolean, default True
When calling apply, add group keys to index to identify pieces
squeeze : boolean, default False
reduce the dimensionality of the return type if possible, otherwise return a consistent type
Returns:
GroupBy object
Examples
DataFrame results
>>> data.groupby(func, axis=0).mean()>>> data.groupby(['col1', 'col2'])['col3'].mean()
DataFrame with hierarchical index
>>> data.groupby(['col1', 'col2']).mean()
- python科学计算笔记(六)pandas 分组groupby
- python库学习笔记——分组计算利器:pandas中的groupby技术
- python科学计算笔记(二)pandas获取网络文件
- python科学计算笔记(五)pandas 时间序列resample
- python科学计算笔记(七)pandas透视表 pivot_table
- python科学计算笔记(十二)pandas的resample采样
- Pandas GroupBy 分组(分割-应用-组合)
- python科学计算一:pandas
- python科学计算四:pandas
- python/pandas数据挖掘(十四)-groupby,聚合,分组级运算
- python科学计算笔记(三)pandas中Series和DataFrame练习
- python科学计算笔记(四)pandas 数据索引与选取
- python科学计算笔记(八)pandas大数据HDF5硬盘操作方式
- python科学计算笔记(九)pandas中DataFrame数据操作函数
- python科学计算笔记(十)pandas中时间、日期以及时间序列处理
- python科学计算笔记(十一)pandas中date_range生成指定日期
- python科学计算笔记(十三)pandas的merge、concat合并数据集
- python科学计算笔记(十四)pandas数据过滤、清理、转换
- 零基础写Java知乎爬虫之抓取知乎答案
- NIT 股市风云 按位与运算&&&&& F. 休赛季的引援#2
- 20170726
- XML的解析
- hibernate相关配置----配置文件形式配置实体
- python科学计算笔记(六)pandas 分组groupby
- jquery.from表单取值
- Always On对Replication的影响
- loadrunner11录制脚本时调用浏览器遇到的问题
- day13之二叉树的前中后序遍历非递归+两个链表求差集
- 慢慢
- 信息检索导论(第二章) 词项词典及倒排记录表
- CSS:改变用户选中文字的颜色和背景颜色
- Jenkins Job Notification 插件配置