Skip to content

Commit 92486a4

Browse files
committed
Pandas
1 parent d3fec31 commit 92486a4

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,7 @@ y 2
31293129
+-------------+-------------+-------------+---------------+
31303130
| | 'sum' | ['sum'] | {'s': 'sum'} |
31313131
+-------------+-------------+-------------+---------------+
3132-
| sr.apply(…) | 3 | sum 3 | s 3 |
3132+
| sr.apply(…) | 3 | sum 3 | s 3 |
31333133
| sr.agg(…) | | | |
31343134
+-------------+-------------+-------------+---------------+
31353135
```
@@ -3139,11 +3139,11 @@ y 2
31393139
| | 'rank' | ['rank'] | {'r': 'rank'} |
31403140
+-------------+-------------+-------------+---------------+
31413141
| sr.apply(…) | | rank | |
3142-
| sr.agg(…) | x 1 | x 1 | r x 1 |
3143-
| sr.trans(…) | y 2 | y 2 | y 2 |
3142+
| sr.agg(…) | x 1 | x 1 | r x 1 |
3143+
| sr.trans(…) | y 2 | y 2 | y 2 |
31443144
+-------------+-------------+-------------+---------------+
31453145
```
3146-
* **Last result has a hierarchical index. Use `'<Sr>[<key_1>, <key_2>]'` to get the value.**
3146+
* **Last result has a hierarchical index. Use `'<Sr>[key_1, key_2]'` to get its values.**
31473147

31483148
### DataFrame
31493149
**Table with labeled rows and columns.**
@@ -3248,9 +3248,9 @@ b 3 4
32483248
+-------------+-------------+-------------+---------------+
32493249
| | 'sum' | ['sum'] | {'x': 'sum'} |
32503250
+-------------+-------------+-------------+---------------+
3251-
| df.apply(…) | | x y | |
3252-
| df.agg(…) | x 4 | sum 4 6 | x 4 |
3253-
| | y 6 | | |
3251+
| df.apply(…) | | x y | |
3252+
| df.agg(…) | x 4 | sum 4 6 | x 4 |
3253+
| | y 6 | | |
32543254
+-------------+-------------+-------------+---------------+
32553255
```
32563256

@@ -3264,6 +3264,7 @@ b 3 4
32643264
| | | b 2 2 | |
32653265
+-------------+-------------+-------------+---------------+
32663266
```
3267+
* **Use `'<DF>[col_key_1, col_key_2][row_key]'` to get the fifth result's values.**
32673268

32683269
#### Encode, Decode:
32693270
```python

index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,20 +2668,20 @@
26682668
<pre><code class="python hljs">┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
26692669
┃ │ <span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'s'</span>: <span class="hljs-string">'sum'</span>} ┃
26702670
┠─────────────┼─────────────┼─────────────┼───────────────┨
2671-
┃ sr.apply(…) │ <span class="hljs-number">3</span> │ sum <span class="hljs-number">3</span> │ s <span class="hljs-number">3</span>
2671+
┃ sr.apply(…) │ <span class="hljs-number">3</span> │ sum <span class="hljs-number">3</span> │ s <span class="hljs-number">3</span>
26722672
┃ sr.agg(…) │ │ │ ┃
26732673
┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
26742674
</code></pre>
26752675
<pre><code class="python hljs">┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
26762676
┃ │ <span class="hljs-string">'rank'</span> │ [<span class="hljs-string">'rank'</span>] │ {<span class="hljs-string">'r'</span>: <span class="hljs-string">'rank'</span>} ┃
26772677
┠─────────────┼─────────────┼─────────────┼───────────────┨
26782678
┃ sr.apply(…) │ │ rank │ ┃
2679-
┃ sr.agg(…) │ x <span class="hljs-number">1</span> │ x <span class="hljs-number">1</span> │ r x <span class="hljs-number">1</span>
2680-
┃ sr.trans(…) │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span>
2679+
┃ sr.agg(…) │ x <span class="hljs-number">1</span> │ x <span class="hljs-number">1</span> │ r x <span class="hljs-number">1</span>
2680+
┃ sr.trans(…) │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span> │ y <span class="hljs-number">2</span>
26812681
┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
26822682
</code></pre>
26832683
<ul>
2684-
<li><strong>Last result has a hierarchical index. Use <code class="python hljs"><span class="hljs-string">'&lt;Sr&gt;[&lt;key_1&gt;, &lt;key_2&gt;]'</span></code> to get the value.</strong></li>
2684+
<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>
26852685
</ul>
26862686
<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>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>])
26872687
x y
@@ -2766,9 +2766,9 @@
27662766
<pre><code class="python hljs">┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
27672767
┃ │ <span class="hljs-string">'sum'</span> │ [<span class="hljs-string">'sum'</span>] │ {<span class="hljs-string">'x'</span>: <span class="hljs-string">'sum'</span>} ┃
27682768
┠─────────────┼─────────────┼─────────────┼───────────────┨
2769-
┃ df.apply(…) │ │ x y │ ┃
2770-
┃ 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>
2771-
┃ │ y <span class="hljs-number">6</span> │ │ ┃
2769+
┃ df.apply(…) │ │ x y │ ┃
2770+
┃ 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>
2771+
┃ │ y <span class="hljs-number">6</span> │ │ ┃
27722772
┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
27732773
</code></pre>
27742774
<pre><code class="python hljs">┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
@@ -2780,6 +2780,9 @@
27802780
┃ │ │ b <span class="hljs-number">2</span> <span class="hljs-number">2</span> │ ┃
27812781
┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
27822782
</code></pre>
2783+
<ul>
2784+
<li><strong>Use <code class="python hljs"><span class="hljs-string">'&lt;DF&gt;[col_key_1, col_key_2][row_key]'</span></code> to get the fifth result's values.</strong></li>
2785+
</ul>
27832786
<div><h4 id="encodedecode">Encode, Decode:</h4><pre><code class="python language-python hljs">&lt;DF&gt; = pd.read_json/html(<span class="hljs-string">'&lt;str/path/url&gt;'</span>)
27842787
&lt;DF&gt; = pd.read_csv/pickle/excel(<span class="hljs-string">'&lt;path/url&gt;'</span>)
27852788
&lt;DF&gt; = pd.read_sql(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;connection&gt;)

parse.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,13 @@ const DIAGRAM_12_B =
275275
'┗━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━━━━┛\n';
276276

277277
const DIAGRAM_13_A =
278-
'| sr.apply(…) | 3 | sum 3 | s 3 |';
278+
'| sr.apply(…) | 3 | sum 3 | s 3 |';
279279

280280
const DIAGRAM_13_B =
281281
"┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
282282
"┃ │ 'sum' │ ['sum'] │ {'s': 'sum'} ┃\n" +
283283
"┠─────────────┼─────────────┼─────────────┼───────────────┨\n" +
284-
"┃ sr.apply(…) │ 3 │ sum 3 │ s 3 ┃\n" +
284+
"┃ sr.apply(…) │ 3 │ sum 3 │ s 3 ┃\n" +
285285
"┃ sr.agg(…) │ │ │ ┃\n" +
286286
"┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
287287

@@ -293,8 +293,8 @@ const DIAGRAM_14_B =
293293
"┃ │ 'rank' │ ['rank'] │ {'r': 'rank'} ┃\n" +
294294
"┠─────────────┼─────────────┼─────────────┼───────────────┨\n" +
295295
"┃ sr.apply(…) │ │ rank │ ┃\n" +
296-
"┃ sr.agg(…) │ x 1 │ x 1 │ r x 1 ┃\n" +
297-
"┃ sr.trans(…) │ y 2 │ y 2 │ y 2 ┃\n" +
296+
"┃ sr.agg(…) │ x 1 │ x 1 │ r x 1 ┃\n" +
297+
"┃ sr.trans(…) │ y 2 │ y 2 │ y 2 ┃\n" +
298298
"┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
299299

300300
const DIAGRAM_15_A =
@@ -332,15 +332,15 @@ const DIAGRAM_15_B =
332332
"┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n";
333333

334334
const DIAGRAM_16_A =
335-
'| df.apply(…) | | x y | |';
335+
'| df.apply(…) | | x y | |';
336336

337337
const DIAGRAM_16_B =
338338
"┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
339339
"┃ │ 'sum' │ ['sum'] │ {'x': 'sum'} ┃\n" +
340340
"┠─────────────┼─────────────┼─────────────┼───────────────┨\n" +
341-
"┃ df.apply(…) │ │ x y │ ┃\n" +
342-
"┃ df.agg(…) │ x 4 sum 4 6 │ x 4 ┃\n" +
343-
"┃ │ y 6 │ │ ┃\n" +
341+
"┃ df.apply(…) │ │ x y │ ┃\n" +
342+
"┃ df.agg(…) │ x 4 │ sum 4 6 │ x 4 ┃\n" +
343+
"┃ │ y 6 │ │ ┃\n" +
344344
"┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
345345

346346
const DIAGRAM_17_A =

0 commit comments

Comments
 (0)