Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas 3.0.3 documentation
An exception to this is that pandas ... user guide linked above for more details. ... >>> ser = pd.Series([390., 350., 30., 20.], ... index=['Falcon', 'Falcon', 'Parrot', 'Parrot'], ......
Pandas
pandas.pydata.org › docs › reference › api › pandas.core.groupby.SeriesGroupBy.indices.html
pandas.core.groupby.SeriesGroupBy.indices — pandas 2.3.3 documentation
Examples · For SeriesGroupBy: >>> lst = ['a', 'a', 'b'] >>> ser = pd.Series([1, 2, 3], index=lst) >>> ser a 1 a 2 b 3 dtype: int64 >>> ser.groupby(level=0).indices {'a': array([0, 1]), 'b': array([2])} For DataFrameGroupBy: >>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]] >>> df = pd.DataFrame(data, ...
Videos
44:17
The Complete Guide to Python Pandas Groupby - YouTube
05:58
How to use Pandas Groupby Like a Pro! - YouTube
19:03
How to use the Pandas GroupBy function | Pandas tutorial - YouTube
11:05
Group By and Aggregate Functions in Pandas | Python Pandas Tutorials ...
15:50
Group By Function | Pandas Data Analysis Tutorial #1 | Retail Example ...
w3resource
w3resource.com › pandas › series › series-groupby.php
Pandas: Series - groupby() function - w3resource
import numpy as np import pandas as pd arrays = [['Tiger', 'Tiger', 'Dog', 'Dog'], ['Captive', 'Wild', 'Captive', 'Wild']] index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type')) df = pd.DataFrame({'Max Speed': [280., 250., 30., 20.]}, index=index) df.groupby(level=0).mean()
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas 3.0.1 documentation
An exception to this is that pandas ... user guide linked above for more details. ... >>> ser = pd.Series([390., 350., 30., 20.], ... index=['Falcon', 'Falcon', 'Parrot', 'Parrot'], ......
Pandas
pandas.pydata.org › pandas-docs › version › 0.22 › generated › pandas.Series.groupby.html
pandas.Series.groupby — pandas 0.22.0 documentation
Group series using mapper (dict or key function, apply given function to group, return result as series) or by a series of columns. Examples · DataFrame results · >>> data.groupby(func, axis=0).mean() >>> data.groupby(['col1', 'col2'])['col3'].mean() DataFrame with hierarchical index · >>> data.groupby(['col1', 'col2']).mean() index · modules | next | previous | pandas 0.22.0 documentation » ·
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.groupby.html
pandas.DataFrame.groupby — pandas 3.0.3 documentation
DataFrame.groupby(by=None, level=None, *, as_index=True, sort=True, group_keys=True, observed=True, dropna=True)[source]# Group DataFrame using a mapper or by a Series of columns.
pandas
pandas.pydata.org › pandas-docs › dev › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas ain documentation
An exception to this is that pandas ... linked above for more details. ... >>> ser = pd.Series( ... [390.0, 350.0, 30.0, 20.0], ... index=["Falcon", "Falcon", "Parrot", "Parrot"], ......
Pandas
pandas.pydata.org › docs › reference › groupby.html
GroupBy — pandas 3.0.3 documentation - PyData |
pandas.api.typing.DataFrameGroupBy and pandas.api.typing.SeriesGroupBy instances are returned by groupby calls pandas.DataFrame.groupby() and pandas.Series.groupby() respectively · DataFrameGroupBy.__iter__()
Pandas
pandas.pydata.org › pandas-docs › version › 1.5 › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas 1.5.3 documentation
Returns a groupby object that contains information about the groups. ... Convenience method for frequency conversion and resampling of time series. ... See the user guide for more detailed usage and examples, including splitting an object into groups, iterating through groups, selecting a group, aggregation, and more. ... >>> ser = pd.Series([390., 350., 30., 20.], ... index=['Falcon', 'Falcon', 'Parrot', 'Parrot'], name="Max Speed") >>> ser Falcon 390.0 Falcon 350.0 Parrot 30.0 Parrot 20.0 Name: Max Speed, dtype: float64 >>> ser.groupby(["a", "b", "a", "b"]).mean() a 210.0 b 185.0 Name: Max Speed, dtype: float64 >>> ser.groupby(level=0).mean() Falcon 370.0 Parrot 25.0 Name: Max Speed, dtype: float64 >>> ser.groupby(ser > 100).mean() Max Speed False 25.0 True 370.0 Name: Max Speed, dtype: float64
Medium
hussein16mahdi.medium.com › mastering-pandas-part-2-groupby-indexing-fd8cc1842e48
Mastering Pandas — Part 2: GroupBy & Indexing | by Hussein Mhadi | Medium
March 10, 2026 - GroupBy — splitting your data into groups and summarizing each one independently · Indexing — selecting exactly the rows and columns we need, with precision · These two topics are deeply connected in practice. You group data to understand it at a high level, and we index into it to examine the details. Together, they form the core of exploratory data analysis. We’ll use this sample DataFrame throughout all the examples: import pandas as pd data = { 'country': ['USA', 'USA', 'UK', 'UK', 'India', 'India'], 'gender': ['Male', 'Female', 'Male', 'Female', 'Male', 'Female'], 'product': ['Laptop', 'Phone', 'Laptop', 'Tablet', 'Phone', 'Laptop'], 'price': [1200, 800, 1100, 600, 700, 950], 'quantity': [3, 5, 2, 4, 6, 3], 'rating': [4.5, 4.2, 4.8, 3.9, 4.1, 4.6] } df = pd.DataFrame(data)
TutorialsPoint
tutorialspoint.com › python_pandas › python_pandas_groupby_method.htm
Python Pandas - groupBy() method
Following is the syntax of the Python Pandas groupby() method · Series.groupby(by=None, axis=0, level=None, as_index=True, sort=True, group_keys=True, observed=<no_default>, dropna=True)
Pandas
pandas.pydata.org › docs › dev › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas 3.0.0.dev0+2709.g415830fc8f documentation
An exception to this is that pandas ... user guide linked above for more details. ... >>> ser = pd.Series([390., 350., 30., 20.], ... index=['Falcon', 'Falcon', 'Parrot', 'Parrot'], ......
Statology
statology.org › home › pandas: how to group by index and perform calculation
Pandas: How to Group By Index and Perform Calculation
December 18, 2023 - #find count of unique values of 'points' grouped by 'position index column df.groupby(['team', 'points'])['rebounds'].nunique() team points A 7 1 16 1 19 1 B 8 2 9 1 10 1 Name: rebounds, dtype: int64 · The following tutorials explain how to perform other common operations in pandas:
Pandas
pandas.pydata.org › pandas-docs › stable › generated › pandas.DataFrame.groupby.html
pandas.DataFrame.groupby — pandas 2.2.2 documentation
The page has been moved to this page
Pandas
pandas.pydata.org › docs › user_guide › groupby.html
Group by: split-apply-combine — pandas 3.0.3 documentation
Another aggregation example is to compute the size of each group. This is included in GroupBy as the size method. It returns a Series whose index consists of the group names and the values are the sizes of each group.
Linux find Examples
queirozf.com › entries › pandas-dataframe-groupby-examples
Pandas DataFrame: GroupBy Examples
October 18, 2020 - import pandas as pd df = pd.DataFrame({ 'value':[20,22,32,111,33,100,99], 'product':['table','chair','chair','mobile phone','table','mobile phone','table'] }) # you can define a function like this or use a lambda function def count_even_numbers(series): return len([elem for elem in series if ...