Browse Source

Pandas

pull/170/head
Jure Šorn 1 year ago
parent
commit
56a54510be
3 changed files with 37 additions and 41 deletions
  1. 23
      README.md
  2. 27
      index.html
  3. 28
      parse.js

23
README.md

@ -3317,9 +3317,8 @@ b 3 4
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
| | 'sum' | ['sum'] | {'x': 'sum'} | | | 'sum' | ['sum'] | {'x': 'sum'} |
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
| df.apply(…) | | x y | |
| df.agg(…) | x 4 | sum 4 6 | x 4 |
| | y 6 | | |
| df.apply(…) | x 4 | x y | x 4 |
| df.agg(…) | y 6 | sum 4 6 | |
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
``` ```
@ -3327,10 +3326,10 @@ b 3 4
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
| | 'rank' | ['rank'] | {'x': 'rank'} | | | 'rank' | ['rank'] | {'x': 'rank'} |
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
| df.apply(…) | x y | x y | x |
| df.agg(…) | a 1 1 | rank rank | a 1 |
| df.transform(…) | b 2 2 | a 1 1 | b 2 |
| | | b 2 2 | |
| df.apply(…) | | x y | |
| df.agg(…) | x y | rank rank | x |
| df.transform(…) | a 1 1 | a 1 1 | a 1 |
| | b 2 2 | b 2 2 | b 2 |
+-----------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+---------------+
``` ```
* **Use `'<DF>[col_key_1, col_key_2][row_key]'` to get the fifth result's values.** * **Use `'<DF>[col_key_1, col_key_2][row_key]'` to get the fifth result's values.**
@ -3393,11 +3392,11 @@ c 7 8 6
+-----------------+-------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+-------------+---------------+
| | 'sum' | 'rank' | ['rank'] | {'x': 'rank'} | | | 'sum' | 'rank' | ['rank'] | {'x': 'rank'} |
+-----------------+-------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+-------------+---------------+
| gb.agg(…) | x y | x y | x y | x |
| | z | a 1 1 | rank rank | a 1 |
| | 3 1 2 | b 1 1 | a 1 1 | b 1 |
| | 6 11 13 | c 2 2 | b 1 1 | c 2 |
| | | | c 2 2 | |
| gb.agg(…) | x y | | x y | |
| | z | x y | rank rank | x |
| | 3 1 2 | a 1 1 | a 1 1 | a 1 |
| | 6 11 13 | b 1 1 | b 1 1 | b 1 |
| | | c 2 2 | c 2 2 | c 2 |
+-----------------+-------------+-------------+-------------+---------------+ +-----------------+-------------+-------------+-------------+---------------+
| gb.transform(…) | x y | x y | | | | gb.transform(…) | x y | x y | | |
| | a 1 2 | a 1 1 | | | | | a 1 2 | a 1 1 | | |

27
index.html

@ -54,7 +54,7 @@
<body> <body>
<header> <header>
<aside>November 3, 2023</aside>
<aside>November 5, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header> </header>
@ -2703,18 +2703,17 @@ b <span class="hljs-number">3</span> <span class="hljs-number">4</span>
<pre><code class="python hljs">┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓ <pre><code class="python hljs">┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃ │ <span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'sum'</span>} ┃ ┃ │ <span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'sum'</span>} ┃
┠─────────────────┼─────────────┼─────────────┼───────────────┨ ┠─────────────────┼─────────────┼─────────────┼───────────────┨
┃ df.apply(…) │ │ x y │ ┃
┃ df.agg(…) │ x <span class="hljs-number">4</span> │ sum <span class="hljs-number">4</span> <span class="hljs-number">6</span> │ x <span class="hljs-number">4</span>
┃ │ y <span class="hljs-number">6</span> │ │ ┃
┃ df.apply(…) │ x <span class="hljs-number">4</span> │ x y │ x <span class="hljs-number">4</span>
┃ df.agg(…) │ y <span class="hljs-number">6</span> │ sum <span class="hljs-number">4</span> <span class="hljs-number">6</span> │ ┃
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃ │ <span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'rank'</span>} ┃ ┃ │ <span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'rank'</span>} ┃
┠─────────────────┼─────────────┼─────────────┼───────────────┨ ┠─────────────────┼─────────────┼─────────────┼───────────────┨
┃ df.apply(…) │ x y │ x y │ x
┃ df.agg(…) │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ rank rank │ a <span class="hljs-number">1</span>
┃ df.transform(…) │ b <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span>b <span class="hljs-number">2</span>
┃ │ │ b <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ ┃
┃ df.apply(…) │ │ x y │
┃ df.agg(…) │ x y │ rank rank │ x
┃ df.transform(…) │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span>a <span class="hljs-number">1</span>
┃ │ b <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ b <span class="hljs-number">2</span> <span class="hljs-number">2</span>b <span class="hljs-number">2</span>
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
</code></pre> </code></pre>
@ -2762,11 +2761,11 @@ c <span class="hljs-number">7</span> <span class="hljs-number">8</span> <span
<pre><code class="python hljs">┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓ <pre><code class="python hljs">┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃ │ <span class="hljs-string">'sum'</span><span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'rank'</span>} ┃ ┃ │ <span class="hljs-string">'sum'</span><span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'rank'</span>} ┃
┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨ ┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨
┃ gb.agg(…) │ x y │ x y │ x y │ x
┃ │ z │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ rank rank │ a <span class="hljs-number">1</span>
┃ │ <span class="hljs-number">3</span> <span class="hljs-number">1</span> <span class="hljs-number">2</span>b <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span>b <span class="hljs-number">1</span>
┃ │ <span class="hljs-number">6</span> <span class="hljs-number">11</span> <span class="hljs-number">13</span>c <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ b <span class="hljs-number">1</span> <span class="hljs-number">1</span>c <span class="hljs-number">2</span>
┃ │ │ │ c <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ ┃
┃ gb.agg(…) │ x y │ │ x y │
┃ │ z │ x y │ rank rank │ x
┃ │ <span class="hljs-number">3</span> <span class="hljs-number">1</span> <span class="hljs-number">2</span>a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span>a <span class="hljs-number">1</span>
┃ │ <span class="hljs-number">6</span> <span class="hljs-number">11</span> <span class="hljs-number">13</span>b <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ b <span class="hljs-number">1</span> <span class="hljs-number">1</span>b <span class="hljs-number">1</span>
┃ │ │ c <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ c <span class="hljs-number">2</span> <span class="hljs-number">2</span>c <span class="hljs-number">2</span>
┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨ ┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨
┃ gb.transform(…) │ x y │ x y │ │ ┃ ┃ gb.transform(…) │ x y │ x y │ │ ┃
┃ │ a <span class="hljs-number">1</span> <span class="hljs-number">2</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ │ ┃ ┃ │ a <span class="hljs-number">1</span> <span class="hljs-number">2</span> │ a <span class="hljs-number">1</span> <span class="hljs-number">1</span> │ │ ┃
@ -2925,7 +2924,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the activ
<footer> <footer>
<aside>November 3, 2023</aside>
<aside>November 5, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer> </footer>

28
parse.js

@ -603,41 +603,40 @@ const DIAGRAM_15_B =
"┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n"; "┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n";
const DIAGRAM_16_A = const DIAGRAM_16_A =
'| df.apply(…) | | x y | |';
'| df.apply(…) | x 4 | x y | x 4 |';
const DIAGRAM_16_B = const DIAGRAM_16_B =
"┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
"┃ │ 'sum' │ ['sum'] │ {'x': 'sum'} ┃\n" + "┃ │ 'sum' │ ['sum'] │ {'x': 'sum'} ┃\n" +
"┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" +
"┃ df.apply(…) │ │ x y │ ┃\n" +
"┃ df.agg(…) │ x 4 │ sum 4 6 │ x 4 ┃\n" +
"┃ │ y 6 │ │ ┃\n" +
"┃ df.apply(…) │ x 4 │ x y │ x 4 ┃\n" +
"┃ df.agg(…) │ y 6 │ sum 4 6 │ ┃\n" +
"┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" + "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" +
"\n" + "\n" +
"┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
"┃ │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" + "┃ │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" +
"┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┠─────────────────┼─────────────┼─────────────┼───────────────┨\n" +
"┃ df.apply(…) │ x y │ x y │ x ┃\n" +
"┃ df.agg(…) │ a 1 1 │ rank rank │ a 1 ┃\n" +
"┃ df.transform(…) │ b 2 2 │ a 1 1 │ b 2 ┃\n" +
"┃ │ │ b 2 2 │ ┃\n" +
"┃ df.apply(…) │ │ x y │ ┃\n" +
"┃ df.agg(…) │ x y │ rank rank │ x ┃\n" +
"┃ df.transform(…) │ a 1 1 │ a 1 1 │ a 1 ┃\n" +
"┃ │ b 2 2 │ b 2 2 │ b 2 ┃\n" +
"┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
const DIAGRAM_17_A = const DIAGRAM_17_A =
"| | 'rank' | ['rank'] | {'x': 'rank'} |"; "| | 'rank' | ['rank'] | {'x': 'rank'} |";
const DIAGRAM_18_A = const DIAGRAM_18_A =
'| gb.agg(…) | x y | x y | x y | x |';
'| gb.agg(…) | x y | | x y | |';
const DIAGRAM_18_B = const DIAGRAM_18_B =
"┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
"┃ │ 'sum' │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" + "┃ │ 'sum' │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" +
"┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" + "┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" +
"┃ gb.agg(…) │ x y │ x y │ x y │ x ┃\n" +
"┃ │ z │ a 1 1 │ rank rank │ a 1 ┃\n" +
"┃ │ 3 1 2 │ b 1 1 │ a 1 1 │ b 1 ┃\n" +
"┃ │ 6 11 13 │ c 2 2 │ b 1 1 │ c 2 ┃\n" +
"┃ │ │ │ c 2 2 │ ┃\n" +
"┃ gb.agg(…) │ x y │ │ x y │ ┃\n" +
"┃ │ z │ x y │ rank rank │ x ┃\n" +
"┃ │ 3 1 2 │ a 1 1 │ a 1 1 │ a 1 ┃\n" +
"┃ │ 6 11 13 │ b 1 1 │ b 1 1 │ b 1 ┃\n" +
"┃ │ │ c 2 2 │ c 2 2 │ c 2 ┃\n" +
"┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" + "┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" +
"┃ gb.transform(…) │ x y │ x y │ │ ┃\n" + "┃ gb.transform(…) │ x y │ x y │ │ ┃\n" +
"┃ │ a 1 2 │ a 1 1 │ │ ┃\n" + "┃ │ a 1 2 │ a 1 1 │ │ ┃\n" +
@ -645,7 +644,6 @@ const DIAGRAM_18_B =
"┃ │ c 11 13 │ c 2 2 │ │ ┃\n" + "┃ │ c 11 13 │ c 2 2 │ │ ┃\n" +
"┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
const MENU = '<a href="https://raw.githubusercontent.com/gto76/python-cheatsheet/main/README.md">Download text file</a>, <a href="https://transactions.sendowl.com/products/78175486/4422834F/view">Buy PDF</a>, <a href="https://github.com/gto76/python-cheatsheet">Fork me on GitHub</a>, <a href="https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions">Check out FAQ</a> or <a href="index.html?theme=dark3">Switch to dark theme</a>.\n'; const MENU = '<a href="https://raw.githubusercontent.com/gto76/python-cheatsheet/main/README.md">Download text file</a>, <a href="https://transactions.sendowl.com/products/78175486/4422834F/view">Buy PDF</a>, <a href="https://github.com/gto76/python-cheatsheet">Fork me on GitHub</a>, <a href="https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions">Check out FAQ</a> or <a href="index.html?theme=dark3">Switch to dark theme</a>.\n';
const DARK_THEME_SCRIPT = const DARK_THEME_SCRIPT =

Loading…
Cancel
Save