diff --git a/README.md b/README.md index 234aa31..999b99e 100644 --- a/README.md +++ b/README.md @@ -3286,6 +3286,17 @@ b 3 4 ### GroupBy **Object that groups together rows of a dataframe based on the value of passed column.** +```python +>>> df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], index=list('abc'), columns=list('xyz')) +>>> df.groupby('z').get_group(3) + x y +a 1 2 +>>> df.groupby('z').get_group(6) + x y +b 4 5 +c 7 8 +``` + ```python = .groupby(column_key/s) # DF is split into groups based on passed column. = .get_group(group_key) # Selects a group by value of grouping column. @@ -3299,7 +3310,6 @@ b 3 4 ``` ```python ->>> df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], index=list('abc'), columns=list('xyz')) >>> gb = df.groupby('z') x y z 3: a 1 2 3 @@ -3325,12 +3335,12 @@ b 3 4 ``` ### Rolling +**Object for rolling window calculations.** + ```python - = .rolling(window_size) # Also: `min_periods=None, center=False`. - = [column_key/s] # Or: .column_key - = .sum/max/mean() - = .apply() # Invokes function on every window. - = .aggregate() # Invokes function on every window. + = .rolling(window_size) # Also: `min_periods=None, center=False`. + = [column_key/s] # Or: .column_key + = .sum/max/mean() # Or: .apply/agg() ``` diff --git a/index.html b/index.html index 2074c7e..5cff2ce 100644 --- a/index.html +++ b/index.html @@ -2778,18 +2778,26 @@ b 3 4 <DF>.to_pickle/excel(<path>) <DF>.to_sql('<table_name>', <connection>) -

GroupBy

Object that groups together rows of a dataframe based on the value of passed column.

<GB> = <DF>.groupby(column_key/s)             # DF is split into groups based on passed column.
-<DF> = <GB>.get_group(group_key)              # Selects a group by value of grouping column.
+

GroupBy

Object that groups together rows of a dataframe based on the value of passed column.

>>> df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], index=list('abc'), columns=list('xyz'))
+>>> df.groupby('z').get_group(3)
+   x  y
+a  1  2
+>>> df.groupby('z').get_group(6)
+   x  y
+b  4  5
+c  7  8
 
+
<GB> = <DF>.groupby(column_key/s)             # DF is split into groups based on passed column.
+<DF> = <GB>.get_group(group_key)              # Selects a group by value of grouping column.
+

Apply, Aggregate, Transform:

<DF> = <GB>.sum/max/mean/idxmax/all()         # Or: <GB>.apply/agg(<agg_func>)
 <DF> = <GB>.rank/diff/cumsum/ffill()          # Or: <GB>.aggregate(<trans_func>)  
 <DF> = <GB>.fillna(<el>)                      # Or: <GB>.transform(<map_func>)
 
-
>>> df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], index=list('abc'), columns=list('xyz'))
->>> gb = df.groupby('z')
+
>>> gb = df.groupby('z')
       x  y  z
 3: a  1  2  3
 6: b  4  5  6
@@ -2810,13 +2818,12 @@ b  3  4
 |             |  c  11  13  |   c  1  1   |             |               |
 +-------------+-------------+-------------+-------------+---------------+
 
-

Rolling

<Rl_S/D/G> = <Sr/DF/GB>.rolling(window_size)  # Also: `min_periods=None, center=False`.
-<Rl_S/D>   = <Rl_D/G>[column_key/s]           # Or: <Rl>.column_key
-<Sr/DF/DF> = <Rl_S/D/G>.sum/max/mean()
-<Sr/DF/DF> = <Rl_S/D/G>.apply(<agg_func>)     # Invokes function on every window.
-<Sr/DF/DF> = <Rl_S/D/G>.aggregate(<func/str>) # Invokes function on every window.
+

Rolling

Object for rolling window calculations.

<R_Sr/R_DF/R_GB> = <Sr/DF/GB>.rolling(window_size)  # Also: `min_periods=None, center=False`.
+<R_Sr/R_DF>      = <R_DF/R_GB>[column_key/s]        # Or: <R>.column_key
+<Sr/DF/DF>       = <R_Sr/R_DF/R_GB>.sum/max/mean()  # Or: <R>.apply/agg(<agg_func/str>)
 
+

#Plotly

Top 10 Countries by Percentage of Population With Confirmed COVID-19 Infection

|
 |
 |