Browse Source

Pandas

pull/156/head
Jure Šorn 1 year ago
parent
commit
e31acdc31c
3 changed files with 50 additions and 50 deletions
  1. 34
      README.md
  2. 36
      index.html
  3. 30
      parse.js

34
README.md

@ -2692,7 +2692,7 @@ import numpy as np
<2d_bools> = <2d_array> ><== <el/1d/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 `'<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.**

36
index.html

@ -54,7 +54,7 @@
<body>
<header>
<aside>March 13, 2023</aside>
<aside>March 21, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -2204,7 +2204,7 @@ drawer = cg.output.GraphvizOutput(output_file=filename)
&lt;1d/2d_a&gt; = &lt;2d_array&gt;[&lt;2d/1d_bools&gt;] <span class="hljs-comment"># 1d_bools must have size of a column.</span>
</code></pre>
<ul>
<li><strong>Indexes should not be tuples because Python converts <code class="python hljs"><span class="hljs-string">'obj[i, j]'</span></code> to <code class="python hljs"><span class="hljs-string">'obj[(i, j)]'</span></code>.</strong></li>
<li><strong>Indexes should not be tuples because Python converts <code class="python hljs"><span class="hljs-string">'obj[i, j]'</span></code> to <code class="python hljs"><span class="hljs-string">'obj[(i, j)]'</span></code>!</strong></li>
<li><strong>Any value that is broadcastable to the indexed shape can be assigned to the selection.</strong></li>
</ul>
<div><h3 id="broadcasting">Broadcasting</h3><p><strong>Set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
@ -2607,26 +2607,26 @@ plt.show() <span class="hljs-comment"># Disp
x <span class="hljs-number">1</span>
y <span class="hljs-number">2</span>
</code></pre>
<pre><code class="python hljs">┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
<span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'s'</span>: <span class="hljs-string">'sum'</span>} ┃
┠─────────────────┼─────────────┼─────────────┼───────────────┨
┃ sr.apply(…) <span class="hljs-number">3</span> │ sum <span class="hljs-number">3</span> │ s <span class="hljs-number">3</span>
┃ sr.agg(…) │ │ │ ┃
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
<pre><code class="python hljs">┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃ │ <span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'s'</span>: <span class="hljs-string">'sum'</span>} ┃
┠───────────────┼─────────────┼─────────────┼───────────────┨
┃ sr.apply(…) │ <span class="hljs-number">3</span> │ sum <span class="hljs-number">3</span> │ s <span class="hljs-number">3</span>
┃ sr.agg(…) │ │ │ ┃
┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
<span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'r'</span>: <span class="hljs-string">'rank'</span>} ┃
┠─────────────────┼─────────────┼─────────────┼───────────────┨
┃ sr.apply(…) │ │ rank │ ┃
┃ sr.agg(…) │ x <span class="hljs-number">1</span> │ x <span class="hljs-number">1</span> │ r x <span class="hljs-number">1</span>
sr.transform(…) │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span>
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃ │ <span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'r'</span>: <span class="hljs-string">'rank'</span>} ┃
┠───────────────┼─────────────┼─────────────┼───────────────┨
┃ sr.apply(…) │ │ rank │ ┃
┃ sr.agg(…) │ x <span class="hljs-number">1</span> │ x <span class="hljs-number">1</span> │ r x <span class="hljs-number">1</span>
│ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span>
┗━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
</code></pre>
<ul>
<li><strong>Methods ffill(), interpolate() and fillna() accept argument 'inplace' that defaults to False.</strong></li>
<li><strong>Keys/indexes/bools can't be tuples because <code class="python hljs"><span class="hljs-string">'obj[x, y]'</span></code> is converted to <code class="python hljs"><span class="hljs-string">'obj[(x, y)]'</span></code>!</strong></li>
<li><strong>Methods ffill(), interpolate(), fillna() and dropna() accept <code class="python hljs"><span class="hljs-string">'inplace=True'</span></code>.</strong></li>
<li><strong>Last result has a hierarchical index. Use <code class="python hljs"><span class="hljs-string">'&lt;Sr&gt;[key_1, key_2]'</span></code> to get its values.</strong></li>
<li><strong>Keys/indexes/bools can't be tuples because <code class="python hljs"><span class="hljs-string">'obj[x, y]'</span></code> is converted to <code class="python hljs"><span class="hljs-string">'obj[(x, y)]'</span></code>.</strong></li>
</ul>
<div><h3 id="dataframe">DataFrame</h3><p><strong>Table with labeled rows and columns.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>pd.DataFrame([[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], index=[<span class="hljs-string">'a'</span>, <span class="hljs-string">'b'</span>], columns=[<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>])
x y
@ -2934,7 +2934,7 @@ $ pyinstaller script.py --add-data '&lt;path&gt;:.' <span class="hljs-comment">
<footer>
<aside>March 13, 2023</aside>
<aside>March 21, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

30
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 =
'+------------------------+---------------+------------+------------+--------------------------+';

Loading…
Cancel
Save