|
55 | 55 |
|
56 | 56 | <body> |
57 | 57 | <header> |
58 | | - <aside>December 13, 2024</aside> |
| 58 | + <aside>December 14, 2024</aside> |
59 | 59 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
60 | 60 | </header> |
61 | 61 |
|
@@ -2720,8 +2720,8 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2720 | 2720 | <li><strong>All methods operate on columns by default. Pass <code class="python hljs"><span class="hljs-string">'axis=1'</span></code> to process the rows instead.</strong></li> |
2721 | 2721 | <li><strong>Fifth result's columns are indexed with a multi-index. This means we need a tuple of column keys to specify a column: <code class="python hljs"><span class="hljs-string">'<DF>.loc[row_key, (col_key_1, col_key_2)]'</span></code>.</strong></li> |
2722 | 2722 | </ul> |
2723 | | -<div><h4 id="dataframemultiindex">DataFrame — Multi-Index:</h4><pre><code class="python language-python hljs"><DF> = <DF>.xs(row_key, level=<int>) <span class="hljs-comment"># Rows with key on passed level of multi-index.</span> |
2724 | | -<DF> = <DF>.xs(row_keys, level=<ints>) <span class="hljs-comment"># Rows that have first key on first level, etc.</span> |
| 2723 | +<div><h4 id="dataframemultiindex">DataFrame — Multi-Index:</h4><pre><code class="python language-python hljs"><DF> = <DF>.xs(key, level=<int>) <span class="hljs-comment"># Rows with key on passed level of multi-index.</span> |
| 2724 | +<DF> = <DF>.xs(keys, level=<ints>, axis=<span class="hljs-number">1</span>) <span class="hljs-comment"># Cols that have first key on first level, etc.</span> |
2725 | 2725 | <DF> = <DF>.set_index(col_keys) <span class="hljs-comment"># Combines multiple columns into a multi-index.</span> |
2726 | 2726 | <S/DF> = <DF>.stack/unstack(level=<span class="hljs-number">-1</span>) <span class="hljs-comment"># Combines col keys with row keys or vice versa.</span> |
2727 | 2727 | <DF> = <DF>.pivot_table(index=col_key/s) <span class="hljs-comment"># `columns=key/s, values=key/s, aggfunc='mean'`.</span> |
@@ -2922,7 +2922,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2922 | 2922 |
|
2923 | 2923 |
|
2924 | 2924 | <footer> |
2925 | | - <aside>December 13, 2024</aside> |
| 2925 | + <aside>December 14, 2024</aside> |
2926 | 2926 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
2927 | 2927 | </footer> |
2928 | 2928 |
|
|
0 commit comments