df.groupby(column_name)
or
df.groupby([column_names])
-
Group DataFrame by values in columns specified in column_name or a list of column_names.
A groupby operation groups large amounts of data based on the column name(s)
- Input:
- column_name : string
- Groups by the column specified. The column becomes the index.
- column_names : list (of strings)
- Groups by all listed columns, starting with the first one in the list. The columns become the indices.
- Note:
- Grouping without an aggregate method will return a DataFrameGroupBy object (not DataFrame)
-
Aggregate Methods
-
.mean()
.median()
.count()
.max()
.min()
.sum()
-
- Returns:
- df_gb - groupby object that contains information about the groups.
- Return Type:
- DataFrameGroupBy
+
Group DataFrame by values in columns specified in column_name or a list of column_names.
A groupby operation groups large amounts of data based on the column name(s)
- Input:
- column_name : string
- Groups by the column specified. The column becomes the index.
- column_names : list (of strings)
- Groups by all listed columns, starting with the first one in the list. The columns become the indices.
- Note:
- Grouping without an aggregate method will return a DataFrameGroupBy object (not DataFrame)
Aggregate Methods
+
.mean()
.median()
.count()
.max()
.min()
.sum()
+
df.groupby(column_name).aggregate_method()
+
- Returns:
- A new DataFrame with the parameter column(s) as the index and all other columns grouped.
- Return Type:
- DataFrame
Index | Species | Color | Weight | Age |
---|
0 | dog | black | 40 | 5 |
1 | cat | golden | 15 | 8 |
2 | cat | black | 20 | 9 |
3 | dog | white | 80 | 2 |
4 | dog | black | 25 | 0.5 |
5 | hamster | black | 1 | 3 |
6 | hamster | golden | 0.25 | 0.2 |
diff --git a/docs/intro/index.html b/docs/intro/index.html
index de2ac5fc..0727af65 100644
--- a/docs/intro/index.html
+++ b/docs/intro/index.html
@@ -5,7 +5,7 @@
intro | bpd
-
+
diff --git a/docs/plotting/histogram/index.html b/docs/plotting/histogram/index.html
index bd741a0d..6a6e4427 100644
--- a/docs/plotting/histogram/index.html
+++ b/docs/plotting/histogram/index.html
@@ -5,7 +5,7 @@
histogram | bpd
-
+
diff --git a/docs/series-methods/ser.count()/index.html b/docs/series-methods/ser.count()/index.html
index afcdfb4f..9851dc88 100644
--- a/docs/series-methods/ser.count()/index.html
+++ b/docs/series-methods/ser.count()/index.html
@@ -5,7 +5,7 @@
ser.count() | bpd
-
+
diff --git a/docs/series-methods/ser.max()/index.html b/docs/series-methods/ser.max()/index.html
index 88fd83e7..00c0c4d3 100644
--- a/docs/series-methods/ser.max()/index.html
+++ b/docs/series-methods/ser.max()/index.html
@@ -5,7 +5,7 @@
ser.max() | bpd
-
+
diff --git a/docs/tutorial-basics/congratulations/index.html b/docs/tutorial-basics/congratulations/index.html
index cd49f647..c4a9c4c1 100644
--- a/docs/tutorial-basics/congratulations/index.html
+++ b/docs/tutorial-basics/congratulations/index.html
@@ -5,7 +5,7 @@
Congratulations! | bpd
-
+
diff --git a/docs/tutorial-basics/create-a-blog-post/index.html b/docs/tutorial-basics/create-a-blog-post/index.html
index 69780510..5b82ffec 100644
--- a/docs/tutorial-basics/create-a-blog-post/index.html
+++ b/docs/tutorial-basics/create-a-blog-post/index.html
@@ -5,7 +5,7 @@
Create a Blog Post | bpd
-
+
diff --git a/docs/tutorial-basics/create-a-document/index.html b/docs/tutorial-basics/create-a-document/index.html
index 666edc79..7963b9ea 100644
--- a/docs/tutorial-basics/create-a-document/index.html
+++ b/docs/tutorial-basics/create-a-document/index.html
@@ -5,7 +5,7 @@
Create a Document | bpd
-
+
diff --git a/docs/tutorial-basics/create-a-page/index.html b/docs/tutorial-basics/create-a-page/index.html
index 0517a8db..0df507fe 100644
--- a/docs/tutorial-basics/create-a-page/index.html
+++ b/docs/tutorial-basics/create-a-page/index.html
@@ -5,7 +5,7 @@
Create a Page | bpd
-
+
diff --git a/docs/tutorial-basics/deploy-your-site/index.html b/docs/tutorial-basics/deploy-your-site/index.html
index 12ba3d5b..aa6232a4 100644
--- a/docs/tutorial-basics/deploy-your-site/index.html
+++ b/docs/tutorial-basics/deploy-your-site/index.html
@@ -5,7 +5,7 @@
Deploy your site | bpd
-
+
diff --git a/docs/tutorial-basics/markdown-features/index.html b/docs/tutorial-basics/markdown-features/index.html
index 8068920a..e73621d6 100644
--- a/docs/tutorial-basics/markdown-features/index.html
+++ b/docs/tutorial-basics/markdown-features/index.html
@@ -5,7 +5,7 @@
Markdown Features | bpd
-
+
diff --git a/docs/tutorial-extras/manage-docs-versions/index.html b/docs/tutorial-extras/manage-docs-versions/index.html
index dd012bdb..c435082e 100644
--- a/docs/tutorial-extras/manage-docs-versions/index.html
+++ b/docs/tutorial-extras/manage-docs-versions/index.html
@@ -5,7 +5,7 @@
Manage Docs Versions | bpd
-
+
diff --git a/docs/tutorial-extras/translate-your-site/index.html b/docs/tutorial-extras/translate-your-site/index.html
index 5f95e211..c0920edc 100644
--- a/docs/tutorial-extras/translate-your-site/index.html
+++ b/docs/tutorial-extras/translate-your-site/index.html
@@ -5,7 +5,7 @@
Translate your site | bpd
-
+
diff --git a/index.html b/index.html
index c6a5902d..6af32f7c 100644
--- a/index.html
+++ b/index.html
@@ -5,7 +5,7 @@
bpd reference sheet | bpd
-
+
diff --git a/markdown-page/index.html b/markdown-page/index.html
index aeffa68e..a83369a5 100644
--- a/markdown-page/index.html
+++ b/markdown-page/index.html
@@ -5,7 +5,7 @@
Markdown page example | bpd
-
+