From 1abd12b6e7582ba981b61692dd52492a00c6784b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 25 Jun 2020 15:52:56 +0200 Subject: [PATCH] Working on Pandas --- README.md | 231 +++++++++++++++++++++++++---------------------------- index.html | 219 +++++++++++++++++++++++--------------------------- 2 files changed, 211 insertions(+), 239 deletions(-) diff --git a/README.md b/README.md index 614cced..99d4513 100644 --- a/README.md +++ b/README.md @@ -3111,6 +3111,7 @@ Name: a, dtype: int64 .update() # Updates items that are already present. ``` +#### Apply, Aggregate, Transform: ```python = .sum/max/mean/idxmax/all() # Or: .aggregate() = .diff/cumsum/rank/pct_change() # Or: .agg/transform() @@ -3119,32 +3120,31 @@ Name: a, dtype: int64 * **Also: `'ffill()'` and `'interpolate()'`.** * **The way `'aggregate()'` and `'transform()'` find out whether a function accepts an element or the whole Series is by passing it a single value at first and if it raises an error, then they pass it the whole Series.** -#### Apply, Aggregate, Transform: ```python ->>> sr = Series([1, 2], index=['x', 'y'], name='a') +>>> sr = Series([1, 2], index=['x', 'y']) x 1 y 2 -Name: a, dtype: int64 +dtype: int64 ``` ```python -+-------------+--------+-----------+---------------+ -| | 'sum' | ['sum'] | {'s': 'sum'} | -+-------------+--------+-----------+---------------+ -| sr.apply(…) | | | | -| sr.agg(…) | 3 | sum 3 | s 3 | -| | | | | -+-------------+--------+-----------+---------------+ ++-------------+---------------+---------------+---------------+ +| | 'sum' | ['sum'] | {'s': 'sum'} | ++-------------+---------------+---------------+---------------+ +| sr.apply(…) | | | | +| sr.agg(…) | 3 | sum 3 | s 3 | +| | | | | ++-------------+---------------+---------------+---------------+ ``` ```python -+-------------+--------+-----------+---------------+ -| | 'rank' | ['rank'] | {'r': 'rank'} | -+-------------+--------+-----------+---------------+ -| sr.apply(…) | | rank | | -| sr.agg(…) | x 1 | x 1 | r x 1 | -| sr.trans(…) | y 2 | y 2 | y 2 | -+-------------+--------+-----------+---------------+ ++-------------+---------------+---------------+---------------+ +| | 'rank' | ['rank'] | {'r': 'rank'} | ++-------------+---------------+---------------+---------------+ +| sr.apply(…) | | rank | | +| sr.agg(…) | x 1 | x 1 | r x 1 | +| sr.trans(…) | y 2 | y 2 | y 2 | ++-------------+---------------+---------------+---------------+ ``` ### DataFrame @@ -3187,44 +3187,6 @@ b 3 4 = .melt(id_vars=column_key/s) # Melts on columns. ``` -```python - = .sum/max/mean/idxmax/all() # Or: .apply/agg/transform() - = .diff/cumsum/rank/pct_change() # Or: .apply/agg/transform() - = .fillna() # Or: .applymap() -``` -* **Also: `'ffill()'` and `'interpolate()'`.** -* **All operations operate on columns by default. Use `'axis=1'` parameter to process the rows instead.** - -#### Apply, Aggregate, Transform: -```python ->>> df = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y']) - x y -a 1 2 -b 3 4 -``` - -```python -+-------------+---------------+---------------+---------------+ -| | 'sum' | ['sum'] | {'x': 'sum'} | -+-------------+---------------+---------------+---------------+ -| df.apply(…) | | x y | | -| df.agg(…) | x 4 | sum 4 6 | x 4 | -| df.trans(…) | y 6 | | | -+-------------+---------------+---------------+---------------+ -``` - -```python -+-------------+---------------+---------------+---------------+ -| | 'rank' | ['rank'] | {'x': 'rank'} | -+-------------+---------------+---------------+---------------+ -| df.apply(…) | x y | x y | x | -| df.agg(…) | a 1 1 | rank rank | a 1 | -| df.trans(…) | b 2 2 | a 1 1 | b 2 | -| | | b 2 2 | | -+-------------+---------------+---------------+---------------+ -``` -* **Transform() doesen't work with `['sum']` and `{'x': 'sum'}`.** - #### Merge, Join, Concat: ```python >>> l = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y']) @@ -3269,99 +3231,124 @@ c 6 7 ┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ``` -### GroupBy -**Object that groups together rows of a dataframe based on the value of passed column.** +#### Apply, Aggregate, Transform: +```python + = .sum/max/mean/idxmax/all() # Or: .apply/agg/transform() + = .diff/cumsum/rank/pct_change() # Or: .apply/agg/transform() + = .fillna() # Or: .applymap() +``` +* **Also: `'ffill()'` and `'interpolate()'`.** +* **All operations operate on columns by default. Use `'axis=1'` parameter to process the rows instead.** ```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 -6: b 4 5 6 - c 7 8 6 +>>> df = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y']) + x y +a 1 2 +b 3 4 ``` ```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. - = .() # Executes operation on each col of each group. ++-------------+---------------+---------------+---------------+ +| | 'sum' | ['sum'] | {'x': 'sum'} | ++-------------+---------------+---------------+---------------+ +| df.apply(…) | | x y | | +| df.agg(…) | x 4 | sum 4 6 | x 4 | +| | y 6 | | | ++-------------+---------------+---------------+---------------+ ``` -* **Result of an operation is a dataframe with index made up of group keys. Use `'.reset_index()'` to move the index back into it's own column.** -#### Aggregations: ```python - = .sum/max/mean/idxmax/all() - = .apply/agg/transform() ++-------------+---------------+---------------+---------------+ +| | 'rank' | ['rank'] | {'x': 'rank'} | ++-------------+---------------+---------------+---------------+ +| df.apply(…) | x y | x y | x | +| df.agg(…) | a 1 1 | rank rank | a 1 | +| df.trans(…) | b 2 2 | a 1 1 | b 2 | +| | | b 2 2 | | ++-------------+---------------+---------------+---------------+ ``` +#### Encode: ```python -+-------------+------------+-------------+---------------+ -| | 'sum' | ['sum'] | {'x': 'sum'} | -+-------------+------------+-------------+---------------+ -| gb.apply(…) | x y z | | | -| | z | | | -| | 3 1 2 3 | | | -| | 6 11 13 12 | | | -+-------------+------------+-------------+---------------+ -| gb.agg(…) | x y | x y | x | -| | z | sum sum | z | -| | 3 1 2 | z | 3 1 | -| | 6 11 13 | 3 1 2 | 6 11 | -| | | 6 11 13 | | -+-------------+------------+-------------+---------------+ -| gb.trans(…) | x y | | | -| | a 1 2 | | | -| | b 11 13 | | | -| | c 11 13 | | | -+-------------+------------+-------------+---------------+ + = pd.read_json/html('') + = pd.read_csv/pickle/excel('') + = pd.read_sql('', ) + = pd.read_clipboard() ``` -#### Transformations: +#### Decode: ```python - = .diff/cumsum/rank() # …/pct_change/fillna/ffill() - = .agg/transform() + = .to_dict(['d/l/s/sp/r/i']) + = .to_json/html/csv/markdown/latex([]) +.to_pickle/excel() +.to_sql('', ) ``` +### GroupBy +**Object that groups together rows of a dataframe based on the value of passed column.** + ```python -+-------------+------------+-------------+---------------+ -| | 'rank' | ['rank'] | {'x': 'rank'} | -+-------------+------------+-------------+---------------+ -| gb.agg(…) | x y | x y | x | -| | a 1 1 | rank rank | a 1 | -| | b 1 1 | a 1 1 | b 1 | -| | c 2 2 | b 1 1 | c 2 | -| | | c 2 2 | | -+-------------+------------+-------------+---------------+ -| gb.trans(…) | x y | | | -| | a 1 1 | | | -| | b 1 1 | | | -| | c 1 1 | | | -+-------------+------------+-------------+---------------+ + = .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. ``` -### Rolling +#### Apply, Aggregate, Transform: ```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. + = .sum/max/mean/idxmax/all() # Or: .apply/agg() + = .diff/cumsum/rank/ffill() # Or: .aggregate() + = .fillna() # Or: .transform() ``` -### Encode ```python - = pd.read_json/html('') - = pd.read_csv/pickle/excel('') - = pd.read_sql('', ) - = pd.read_clipboard() +>>> 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 +6: b 4 5 6 + c 7 8 6 ``` -### Decode ```python - = .to_dict(['d/l/s/sp/r/i']) - = .to_json/html/csv/markdown/latex([]) -.to_pickle/excel() -.to_sql('', ) ++-------------+-------------+-------------+---------------+ +| | 'sum' | ['sum'] | {'x': 'sum'} | ++-------------+-------------+-------------+---------------+ +| gb.agg(…) | x y | x y | x | +| | z | sum sum | z | +| | 3 1 2 | z | 3 1 | +| | 6 11 13 | 3 1 2 | 6 11 | +| | | 6 11 13 | | ++-------------+-------------+-------------+---------------+ +| gb.trans(…) | x y | | | +| | a 1 2 | | | +| | b 11 13 | | | +| | c 11 13 | | | ++-------------+-------------+-------------+---------------+ +``` + +```python ++-------------+-------------+-------------+---------------+ +| | 'rank' | ['rank'] | {'x': 'rank'} | ++-------------+-------------+-------------+---------------+ +| gb.agg(…) | x y | x y | x | +| | a 1 1 | rank rank | a 1 | +| | b 1 1 | a 1 1 | b 1 | +| | c 2 2 | b 1 1 | c 2 | +| | | c 2 2 | | ++-------------+-------------+-------------+---------------+ +| gb.trans(…) | x y | | | +| | a 1 1 | | | +| | b 1 1 | | | +| | c 1 1 | | | ++-------------+-------------+-------------+---------------+ +``` + +### Rolling +```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. ``` diff --git a/index.html b/index.html index 0cf2f48..1b5ff38 100644 --- a/index.html +++ b/index.html @@ -2639,35 +2639,35 @@ Name: a, dtype: int64 <Sr> = <Sr>.combine_first(<Sr>) # Adds items that are not yet present. <Sr>.update(<Sr>) # Updates items that are already present. -
<el> = <Sr>.sum/max/mean/idxmax/all()         # Or: <Sr>.aggregate(<agg_func>)
+

Apply, Aggregate, Transform:

<el> = <Sr>.sum/max/mean/idxmax/all()         # Or: <Sr>.aggregate(<agg_func>)
 <Sr> = <Sr>.diff/cumsum/rank/pct_change()     # Or: <Sr>.agg/transform(<trans_func>)
 <Sr> = <Sr>.fillna(<el>)                      # Or: <Sr>.apply/agg/transform/map(<map_func>)
-
+
+
  • Also: 'ffill()' and 'interpolate()'.
  • The way 'aggregate()' and 'transform()' find out whether a function accepts an element or the whole Series is by passing it a single value at first and if it raises an error, then they pass it the whole Series.
-

Apply, Aggregate, Transform:

>>> sr = Series([1, 2], index=['x', 'y'], name='a')
+
>>> sr = Series([1, 2], index=['x', 'y'])
 x    1
 y    2
-Name: a, dtype: int64
-
- -
+-------------+--------+-----------+---------------+
-|             |  'sum' |  ['sum']  |  {'s': 'sum'} |
-+-------------+--------+-----------+---------------+
-| sr.apply(…) |        |           |               |
-| sr.agg(…)   |    3   |   sum 3   |      s  3     |
-|             |        |           |               |
-+-------------+--------+-----------+---------------+
+dtype: int64
 
-
+-------------+--------+-----------+---------------+
-|             | 'rank' | ['rank']  | {'r': 'rank'} |
-+-------------+--------+-----------+---------------+
-| sr.apply(…) |        |     rank  |               |
-| sr.agg(…)   |  x  1  |  x     1  |    r  x  1    |
-| sr.trans(…) |  y  2  |  y     2  |       y  2    |
-+-------------+--------+-----------+---------------+
+
+-------------+---------------+---------------+---------------+
+|             |     'sum'     |    ['sum']    |  {'s': 'sum'} |
++-------------+---------------+---------------+---------------+
+| sr.apply(…) |               |               |               |
+| sr.agg(…)   |       3       |     sum 3     |      s  3     |
+|             |               |               |               |
++-------------+---------------+---------------+---------------+
+
+
+-------------+---------------+---------------+---------------+
+|             |    'rank'     |   ['rank']    | {'r': 'rank'} |
++-------------+---------------+---------------+---------------+
+| sr.apply(…) |               |       rank    |               |
+| sr.agg(…)   |     x  1      |    x     1    |    r  x  1    |
+| sr.trans(…) |     y  2      |    y     2    |       y  2    |
++-------------+---------------+---------------+---------------+
 

DataFrame

Table with labeled rows and columns.

>>> DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
    x  y
@@ -2696,40 +2696,6 @@ b  3  4
 <DF>    = <DF>.transpose()                    # Rotates the table.
 <DF>    = <DF>.melt(id_vars=column_key/s)     # Melts on columns.
 
-
<Sr> = <DF>.sum/max/mean/idxmax/all()         # Or: <DF>.apply/agg/transform(<agg_func>)
-<DF> = <DF>.diff/cumsum/rank/pct_change()     # Or: <DF>.apply/agg/transform(<trans_func>)
-<DF> = <DF>.fillna(<el>)                      # Or: <DF>.applymap(<map_func>)
-
-
    -
  • Also: 'ffill()' and 'interpolate()'.
  • -
  • All operations operate on columns by default. Use 'axis=1' parameter to process the rows instead.
  • -
-

Apply, Aggregate, Transform:

>>> df = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
-   x  y
-a  1  2
-b  3  4
-
- -
+-------------+---------------+---------------+---------------+
-|             |     'sum'     |    ['sum']    | {'x': 'sum'}  |
-+-------------+---------------+---------------+---------------+
-| df.apply(…) |               |        x y    |               |
-| df.agg(…)   |     x  4      |    sum 4 6    |     x  4      |
-| df.trans(…) |     y  6      |               |               |
-+-------------+---------------+---------------+---------------+
-
-
+-------------+---------------+---------------+---------------+
-|             |    'rank'     |   ['rank']    | {'x': 'rank'} |
-+-------------+---------------+---------------+---------------+
-| df.apply(…) |       x  y    |       x    y  |        x      |
-| df.agg(…)   |    a  1  1    |    rank rank  |     a  1      |
-| df.trans(…) |    b  2  2    |  a    1    1  |     b  2      |
-|             |               |  b    2    2  |               |
-+-------------+---------------+---------------+---------------+
-
-
    -
  • Transform() doesen't work with ['sum'] and {'x': 'sum'}.
  • -

Merge, Join, Concat:

>>> l = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
    x  y 
 a  1  2 
@@ -2770,84 +2736,103 @@ c  6  7
 ┃                        │ c  .   6   7  │            │            │                          ┃
 ┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 
-

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'))
->>> gb = df.groupby('z')
-      x  y  z
-3: a  1  2  3
-6: b  4  5  6
-   c  7  8  6
+

Apply, Aggregate, Transform:

<Sr> = <DF>.sum/max/mean/idxmax/all()         # Or: <DF>.apply/agg/transform(<agg_func>)
+<DF> = <DF>.diff/cumsum/rank/pct_change()     # Or: <DF>.apply/agg/transform(<trans_func>)
+<DF> = <DF>.fillna(<el>)                      # Or: <DF>.applymap(<map_func>)
 
- -
<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.
-<DF> = <GB>.<operation>()                     # Executes operation on each col of each group.
-
    -
  • Result of an operation is a dataframe with index made up of group keys. Use '<DF>.reset_index()' to move the index back into it's own column.
  • +
  • Also: 'ffill()' and 'interpolate()'.
  • +
  • All operations operate on columns by default. Use 'axis=1' parameter to process the rows instead.
-

Aggregations:

<DF> = <GB>.sum/max/mean/idxmax/all()
-<DF> = <GB>.apply/agg/transform(<agg_func>)
-
- -
+-------------+------------+-------------+---------------+
-|             |    'sum'   |   ['sum']   | {'x': 'sum'}  |
-+-------------+------------+-------------+---------------+
-| gb.apply(…) |    x  y  z |             |               |
-|             | z          |             |               |
-|             | 3  1  2  3 |             |               |
-|             | 6 11 13 12 |             |               |
-+-------------+------------+-------------+---------------+
-| gb.agg(…)   |     x   y  |      x   y  |         x     |
-|             | z          |    sum sum  |     z         |
-|             | 3   1   2  |  z          |     3   1     |
-|             | 6  11  13  |  3   1   2  |     6  11     |
-|             |            |  6  11  13  |               |
-+-------------+------------+-------------+---------------+
-| gb.trans(…) |     x   y  |             |               |
-|             | a   1   2  |             |               |
-|             | b  11  13  |             |               |
-|             | c  11  13  |             |               |
-+-------------+------------+-------------+---------------+
-
-

Transformations:

<DF> = <GB>.diff/cumsum/rank()                # …/pct_change/fillna/ffill()
-<DF> = <GB>.agg/transform(<trans_func>)
-
- -
+-------------+------------+-------------+---------------+
-|             |   'rank'   |  ['rank']   | {'x': 'rank'} |
-+-------------+------------+-------------+---------------+
-| gb.agg(…)   |     x  y   |      x    y |        x      |
-|             |  a  1  1   |   rank rank |     a  1      |
-|             |  b  1  1   | a    1    1 |     b  1      |
-|             |  c  2  2   | b    1    1 |     c  2      |
-|             |            | c    2    2 |               |
-+-------------+------------+-------------+---------------+
-| gb.trans(…) |     x  y   |             |               |
-|             |  a  1  1   |             |               |
-|             |  b  1  1   |             |               |
-|             |  c  1  1   |             |               |
-+-------------+------------+-------------+---------------+
+
>>> df = DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
+   x  y
+a  1  2
+b  3  4
 
-

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.
-
- -

Encode

<DF> = pd.read_json/html('<str/path/url>')
+
+-------------+---------------+---------------+---------------+
+|             |     'sum'     |    ['sum']    | {'x': 'sum'}  |
++-------------+---------------+---------------+---------------+
+| df.apply(…) |               |        x y    |               |
+| df.agg(…)   |     x  4      |    sum 4 6    |     x  4      |
+|             |     y  6      |               |               |
++-------------+---------------+---------------+---------------+
+
+
+-------------+---------------+---------------+---------------+
+|             |    'rank'     |   ['rank']    | {'x': 'rank'} |
++-------------+---------------+---------------+---------------+
+| df.apply(…) |       x  y    |       x    y  |        x      |
+| df.agg(…)   |    a  1  1    |    rank rank  |     a  1      |
+| df.trans(…) |    b  2  2    |  a    1    1  |     b  2      |
+|             |               |  b    2    2  |               |
++-------------+---------------+---------------+---------------+
+
+

Encode:

<DF> = pd.read_json/html('<str/path/url>')
 <DF> = pd.read_csv/pickle/excel('<path/url>')
 <DF> = pd.read_sql('<query>', <connection>)
 <DF> = pd.read_clipboard()
 
-

Decode

<dict> = <DF>.to_dict(['d/l/s/sp/r/i'])
+

Decode:

<dict> = <DF>.to_dict(['d/l/s/sp/r/i'])
 <str>  = <DF>.to_json/html/csv/markdown/latex([<path>])
 <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.
+
+ + +

Apply, Aggregate, Transform:

<DF> = <GB>.sum/max/mean/idxmax/all()         # Or: <GB>.apply/agg(<agg_func>)
+<DF> = <GB>.diff/cumsum/rank/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')
+      x  y  z
+3: a  1  2  3
+6: b  4  5  6
+   c  7  8  6
+
+
+-------------+-------------+-------------+---------------+
+|             |    'sum'    |   ['sum']   | {'x': 'sum'}  |
++-------------+-------------+-------------+---------------+
+| gb.agg(…)   |      x   y  |      x   y  |         x     |
+|             |  z          |    sum sum  |     z         |
+|             |  3   1   2  |  z          |     3   1     |
+|             |  6  11  13  |  3   1   2  |     6  11     |
+|             |             |  6  11  13  |               |
++-------------+-------------+-------------+---------------+
+| gb.trans(…) |      x   y  |             |               |
+|             |  a   1   2  |             |               |
+|             |  b  11  13  |             |               |
+|             |  c  11  13  |             |               |
++-------------+-------------+-------------+---------------+
+
+
+-------------+-------------+-------------+---------------+
+|             |   'rank'    |  ['rank']   | {'x': 'rank'} |
++-------------+-------------+-------------+---------------+
+| gb.agg(…)   |      x  y   |      x    y |        x      |
+|             |   a  1  1   |   rank rank |     a  1      |
+|             |   b  1  1   | a    1    1 |     b  1      |
+|             |   c  2  2   | b    1    1 |     c  2      |
+|             |             | c    2    2 |               |
++-------------+-------------+-------------+---------------+
+| gb.trans(…) |      x  y   |             |               |
+|             |   a  1  1   |             |               |
+|             |   b  1  1   |             |               |
+|             |   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.
+
+

#Plotly

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

|
 |
 |