From e31acdc31c4d3ced3b6a9ba223c60686a69e82e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 21 Mar 2023 06:00:04 +0100 Subject: [PATCH] Pandas --- README.md | 34 +++++++++++++++++----------------- index.html | 36 ++++++++++++++++++------------------ parse.js | 30 +++++++++++++++--------------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index c4e990f..20e4fe3 100644 --- a/README.md +++ b/README.md @@ -2692,7 +2692,7 @@ import numpy as np <2d_bools> = <2d_array> ><== # 1d_array must have size of a row. <1d/2d_a> = <2d_array>[<2d/1d_bools>] # 1d_bools must have size of a column. ``` -* **Indexes should not be tuples because Python converts `'obj[i, j]'` to `'obj[(i, j)]'`.** +* **Indexes should not be tuples because Python converts `'obj[i, j]'` to `'obj[(i, j)]'`!** * **Any value that is broadcastable to the indexed shape can be assigned to the selection.** ### Broadcasting @@ -3194,26 +3194,26 @@ y 2 ``` ```text -+-----------------+-------------+-------------+---------------+ -| | 'sum' | ['sum'] | {'s': 'sum'} | -+-----------------+-------------+-------------+---------------+ -| sr.apply(…) | 3 | sum 3 | s 3 | -| sr.agg(…) | | | | -+-----------------+-------------+-------------+---------------+ ++---------------+-------------+-------------+---------------+ +| | 'sum' | ['sum'] | {'s': 'sum'} | ++---------------+-------------+-------------+---------------+ +| sr.apply(…) | 3 | sum 3 | s 3 | +| sr.agg(…) | | | | ++---------------+-------------+-------------+---------------+ ``` ```text -+-----------------+-------------+-------------+---------------+ -| | 'rank' | ['rank'] | {'r': 'rank'} | -+-----------------+-------------+-------------+---------------+ -| sr.apply(…) | | rank | | -| sr.agg(…) | x 1 | x 1 | r x 1 | -| sr.transform(…) | y 2 | y 2 | y 2 | -+-----------------+-------------+-------------+---------------+ -``` -* **Methods ffill(), interpolate() and fillna() accept argument 'inplace' that defaults to False.** ++---------------+-------------+-------------+---------------+ +| | 'rank' | ['rank'] | {'r': 'rank'} | ++---------------+-------------+-------------+---------------+ +| sr.apply(…) | | rank | | +| sr.agg(…) | x 1 | x 1 | r x 1 | +| | y 2 | y 2 | y 2 | ++---------------+-------------+-------------+---------------+ +``` +* **Keys/indexes/bools can't be tuples because `'obj[x, y]'` is converted to `'obj[(x, y)]'`!** +* **Methods ffill(), interpolate(), fillna() and dropna() accept `'inplace=True'`.** * **Last result has a hierarchical index. Use `'[key_1, key_2]'` to get its values.** -* **Keys/indexes/bools can't be tuples because `'obj[x, y]'` is converted to `'obj[(x, y)]'`.** ### DataFrame **Table with labeled rows and columns.** diff --git a/index.html b/index.html index b4ba5f9..eccb661 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -2204,7 +2204,7 @@ drawer = cg.output.GraphvizOutput(output_file=filename) <1d/2d_a> = <2d_array>[<2d/1d_bools>] # 1d_bools must have size of a column.
    -
  • Indexes should not be tuples because Python converts 'obj[i, j]' to 'obj[(i, j)]'.
  • +
  • Indexes should not be tuples because Python converts 'obj[i, j]' to 'obj[(i, j)]'!
  • Any value that is broadcastable to the indexed shape can be assigned to the selection.

Broadcasting

Set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.

left  = [[0.1], [0.6], [0.8]]                           # Shape: (3, 1)
@@ -2607,26 +2607,26 @@ plt.show()                                     # Disp
 x    1
 y    2
 
-
┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
-┃                 │    'sum'    │   ['sum']   │ {'s': 'sum'}  ┃
-┠─────────────────┼─────────────┼─────────────┼───────────────┨
-┃ sr.apply(…)     │      3      │    sum  3   │     s  3      ┃
-┃ sr.agg(…)       │             │             │               ┃
-┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
+
┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
+┃               │    'sum'    │   ['sum']   │ {'s': 'sum'}  ┃
+┠───────────────┼─────────────┼─────────────┼───────────────┨
+┃ sr.apply(…)   │      3      │    sum  3   │     s  3      ┃
+┃ sr.agg(…)     │             │             │               ┃
+┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
 
-┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
-┃                 │    'rank'   │   ['rank']  │ {'r': 'rank'} ┃
-┠─────────────────┼─────────────┼─────────────┼───────────────┨
-┃ sr.apply(…)     │             │      rank   │               ┃
-┃ sr.agg(…)       │     x  1    │   x     1   │    r  x  1    ┃
-┃ sr.transform(…) │     y  2    │   y     2   │       y  2    ┃
-┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
+┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
+┃               │    'rank'   │   ['rank']  │ {'r': 'rank'} ┃
+┠───────────────┼─────────────┼─────────────┼───────────────┨
+┃ sr.apply(…)   │             │      rank   │               ┃
+┃ sr.agg(…)     │     x  1    │   x     1   │    r  x  1    ┃
+┃               │     y  2    │   y     2   │       y  2    ┃
+┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
 
    -
  • Methods ffill(), interpolate() and fillna() accept argument 'inplace' that defaults to False.
  • +
  • Keys/indexes/bools can't be tuples because 'obj[x, y]' is converted to 'obj[(x, y)]'!
  • +
  • Methods ffill(), interpolate(), fillna() and dropna() accept 'inplace=True'.
  • Last result has a hierarchical index. Use '<Sr>[key_1, key_2]' to get its values.
  • -
  • Keys/indexes/bools can't be tuples because 'obj[x, y]' is converted to 'obj[(x, y)]'.

DataFrame

Table with labeled rows and columns.

>>> pd.DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
    x  y
@@ -2934,7 +2934,7 @@ $ pyinstaller script.py --add-data '<path>:.'  
  
 
   
 
diff --git a/parse.js b/parse.js
index eb05a8f..8f69ea5 100755
--- a/parse.js
+++ b/parse.js
@@ -496,26 +496,26 @@ const DIAGRAM_12_B =
   '┗━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━━┛\n';
 
 const DIAGRAM_13_A =
-  '| sr.apply(…)     |      3      |    sum  3   |     s  3      |';
+  '| sr.apply(…)   |      3      |    sum  3   |     s  3      |';
 
 const DIAGRAM_13_B =
-  "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
-  "┃                 │    'sum'    │   ['sum']   │ {'s': 'sum'}  ┃\n" +
-  "┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" +
-  "┃ sr.apply(…)     │      3      │    sum  3   │     s  3      ┃\n" +
-  "┃ sr.agg(…)       │             │             │               ┃\n" +
-  "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" +
+  "┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
+  "┃               │    'sum'    │   ['sum']   │ {'s': 'sum'}  ┃\n" +
+  "┠───────────────┼─────────────┼─────────────┼───────────────┨\n" +
+  "┃ sr.apply(…)   │      3      │    sum  3   │     s  3      ┃\n" +
+  "┃ sr.agg(…)     │             │             │               ┃\n" +
+  "┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" +
   "\n" +
-  "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
-  "┃                 │    'rank'   │   ['rank']  │ {'r': 'rank'} ┃\n" +
-  "┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" +
-  "┃ sr.apply(…)     │             │      rank   │               ┃\n" +
-  "┃ sr.agg(…)       │     x  1    │   x     1   │    r  x  1    ┃\n" +
-  "┃ sr.transform(…) │     y  2    │   y     2   │       y  2    ┃\n" +
-  "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
+  "┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
+  "┃               │    'rank'   │   ['rank']  │ {'r': 'rank'} ┃\n" +
+  "┠───────────────┼─────────────┼─────────────┼───────────────┨\n" +
+  "┃ sr.apply(…)   │             │      rank   │               ┃\n" +
+  "┃ sr.agg(…)     │     x  1    │   x     1   │    r  x  1    ┃\n" +
+  "┃               │     y  2    │   y     2   │       y  2    ┃\n" +
+  "┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
 
 const DIAGRAM_14_A =
-  "|                 |    'rank'   |   ['rank']  | {'r': 'rank'} |";
+  "|               |    'rank'   |   ['rank']  | {'r': 'rank'} |";
 
 const DIAGRAM_15_A =
   '+------------------------+---------------+------------+------------+--------------------------+';