From 0c986f0183c4556a6e4914cc3f9aaaaef4e6e610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= <sornjure@gmail.com> Date: Wed, 30 Apr 2025 04:08:33 +0200 Subject: [PATCH] Pandas --- README.md | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a193b50..68364c2 100644 --- a/README.md +++ b/README.md @@ -3189,7 +3189,7 @@ Name: a, dtype: int64 * **Use `'<S>.index'` to get collection of keys and `'<S>.index = <coll>'` to update them.** * **Only pass a list or Series to loc/iloc because `'obj[x, y]'` is converted to `'obj[(x, y)]'` and `'<S>.loc[key_1, key_2]'` is how you retrieve a value from a multi-indexed Series.** * **Pandas uses NumPy types like `'np.int64'`. Series is converted to `'float64'` if we assign np.nan to any item. Use `'<S>.astype(<str/type>)'` to get converted Series.** -* **Series will silently overflow if you run `'pd.Series([100], dtype="int8") + 100'`!** +* **Series will silently overflow if we run `'pd.Series([100], dtype="int8") + 100'`!** #### Series — Aggregate, Transform, Map: ```python diff --git a/index.html b/index.html index adae251..f09fa1d 100644 --- a/index.html +++ b/index.html @@ -2616,7 +2616,7 @@ Name: a, dtype: int64 <li><strong>Use <code class="python hljs"><span class="hljs-string">'<S>.index'</span></code> to get collection of keys and <code class="python hljs"><span class="hljs-string">'<S>.index = <coll>'</span></code> to update them.</strong></li> <li><strong>Only pass a list or Series to loc/iloc 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> and <code class="python hljs"><span class="hljs-string">'<S>.loc[key_1, key_2]'</span></code> is how you retrieve a value from a multi-indexed Series.</strong></li> <li><strong>Pandas uses NumPy types like <code class="python hljs"><span class="hljs-string">'np.int64'</span></code>. Series is converted to <code class="python hljs"><span class="hljs-string">'float64'</span></code> if we assign np.nan to any item. Use <code class="python hljs"><span class="hljs-string">'<S>.astype(<str/type>)'</span></code> to get converted Series.</strong></li> -<li><strong>Series will silently overflow if you run <code class="python hljs"><span class="hljs-string">'pd.Series([100], dtype="int8") + 100'</span></code>!</strong></li> +<li><strong>Series will silently overflow if we run <code class="python hljs"><span class="hljs-string">'pd.Series([100], dtype="int8") + 100'</span></code>!</strong></li> </ul> <div><h4 id="seriesaggregatetransformmap">Series — Aggregate, Transform, Map:</h4><pre><code class="python language-python hljs"><el> = <S>.sum/max/mean/std/idxmax/count() <span class="hljs-comment"># Or: <S>.agg(lambda <S>: <el>)</span> <S> = <S>.rank/diff/cumsum/ffill/interpol…() <span class="hljs-comment"># Or: <S>.agg/transform(lambda <S>: <S>)</span>