Browse Source

Input, Pandas

pull/135/merge
Jure Šorn 2 months ago
parent
commit
72673286e5
2 changed files with 10 additions and 10 deletions
  1. 8
      README.md
  2. 12
      index.html

8
README.md

@ -1531,7 +1531,7 @@ pprint(<collection>, width=80, depth=None, compact=False, sort_dicts=True)
Input
-----
```python
<str> = input([<obj>])
<str> = input()
```
* **Reads a line from the user input or pipe if present (trailing newline gets stripped).**
* **If argument is passed, it gets printed to the standard output before input is read.**
@ -3193,9 +3193,9 @@ Name: a, dtype: int64
```python
<S>.plot.line/area/bar/pie/hist() # Generates a plot. `plt.show()` displays it.
```
* **Indexing objects can't be tuples because `'obj[x, y]'` is converted to `'obj[(x, y)]'`!**
* **Indexing objects can't be tuples because `'obj[x, y]'` is converted to `'obj[(x, y)]'`.**
* **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 we 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
@ -3407,7 +3407,7 @@ z
```python
<RS/RDF/RGB> = <S/DF/GB>.rolling(win_size) # Also: `min_periods=None, center=False`.
<RS/RDF/RGB> = <RDF/RGB>[col_key/s] # Or: <RDF/RGB>.col_key
<RS/RDF/RGB> = <RDF/RGB>[col_key/s] # Or: <RDF/RGB>.<col_key>
<S/DF> = <R>.mean/sum/max() # Or: <R>.apply/agg(<agg_func/str>)
```

12
index.html

@ -55,7 +55,7 @@
<body>
<header>
<aside>December 24, 2024</aside>
<aside>December 25, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -1294,7 +1294,7 @@ pprint(&lt;collection&gt;, width=<span class="hljs-number">80</span>, depth=<spa
<li><strong>Each item is printed on its own line if collection exceeds 'width' characters.</strong></li>
<li><strong>Nested collections that are 'depth' levels deep get printed as '…'.</strong></li>
</ul>
<div><h2 id="input"><a href="#input" name="input">#</a>Input</h2><pre><code class="python language-python hljs">&lt;str&gt; = input([&lt;obj&gt;])
<div><h2 id="input"><a href="#input" name="input">#</a>Input</h2><pre><code class="python language-python hljs">&lt;str&gt; = input()
</code></pre></div>
<ul>
@ -2601,9 +2601,9 @@ Name: a, dtype: int64
<pre><code class="python language-python hljs">&lt;S&gt;.plot.line/area/bar/pie/hist() <span class="hljs-comment"># Generates a plot. `plt.show()` displays it.</span>
</code></pre>
<ul>
<li><strong>Indexing objects 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>Indexing objects 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>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">'&lt;S&gt;.astype(&lt;str/type&gt;)'</span></code> to get converted Series.</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>
<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">&lt;el&gt; = &lt;S&gt;.sum/max/mean/idxmax/all() <span class="hljs-comment"># Or: &lt;S&gt;.agg(lambda &lt;S&gt;: &lt;el&gt;)</span>
&lt;S&gt; = &lt;S&gt;.rank/diff/cumsum/ffill/interpol…() <span class="hljs-comment"># Or: &lt;S&gt;.agg/transform(lambda &lt;S&gt;: &lt;S&gt;)</span>
@ -2772,7 +2772,7 @@ z
<span class="hljs-number">6</span> <span class="hljs-number">11</span> <span class="hljs-number">13</span></code></pre></div>
<div><h3 id="rolling">Rolling</h3><p><strong>Object for rolling window calculations.</strong></p><pre><code class="python language-python hljs">&lt;RS/RDF/RGB&gt; = &lt;S/DF/GB&gt;.rolling(win_size) <span class="hljs-comment"># Also: `min_periods=None, center=False`.</span>
&lt;RS/RDF/RGB&gt; = &lt;RDF/RGB&gt;[col_key/s] <span class="hljs-comment"># Or: &lt;RDF/RGB&gt;.col_key</span>
&lt;RS/RDF/RGB&gt; = &lt;RDF/RGB&gt;[col_key/s] <span class="hljs-comment"># Or: &lt;RDF/RGB&gt;.&lt;col_key&gt;</span>
&lt;S/DF&gt; = &lt;R&gt;.mean/sum/max() <span class="hljs-comment"># Or: &lt;R&gt;.apply/agg(&lt;agg_func/str&gt;)</span>
</code></pre></div>
@ -2934,7 +2934,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active
<footer>
<aside>December 24, 2024</aside>
<aside>December 25, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save