Browse Source

Pandas

pull/135/merge
Jure Šorn 1 month ago
parent
commit
f72fe945c2
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -3185,7 +3185,7 @@ Name: a, dtype: int64
```
```python
<S> = <S>.head/describe/copy/sort_values() # Also <S>.unique/value_counts/round/dropna().
<S> = <S>.head/describe/sort_values() # Also <S>.unique/value_counts/round/dropna().
<S> = <S>.str.strip/lower/contains/replace() # Also split().str[<int>] and split().explode().
<S> = <S>.dt.year/month/day/hour # Use pd.to_datetime(<S>) to get S of dates.
```
@ -3193,6 +3193,7 @@ Name: a, dtype: int64
```python
<S>.plot.line/area/bar/pie/hist() # Generates a plot. `plt.show()` displays it.
```
* **Also: `'pd.cut(<S>, bins=<int/coll>)'`, `'<S>.quantile(<float/coll>)'`.**
* **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'`!**
@ -3222,7 +3223,6 @@ Name: a, dtype: int64
| | y 2.0 | y 2.0 | y 2.0 |
+--------------+-------------+-------------+---------------+
```
* **Methods sort_values(), dropna(), ffill(), interpolate() and fillna() accept `'inplace=True'`.**
* **Agg() and transform() pass a Series to a function if it raises Type/Val/AttrError on a scalar.**
* **Last result has a multi-index. Use `'<S>[key_1, key_2]'` to get its values.**

4
index.html

@ -2594,13 +2594,14 @@ Name: a, dtype: int64
<pre><code class="python language-python hljs">&lt;S&gt; = &lt;S&gt; &gt; &lt;el/S&gt; <span class="hljs-comment"># Returns S of bools. For logic use &amp;, |, ~.</span>
&lt;S&gt; = &lt;S&gt; + &lt;el/S&gt; <span class="hljs-comment"># Items with non-matching keys get value NaN.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;S&gt; = &lt;S&gt;.head/describe/copy/sort_values() <span class="hljs-comment"># Also &lt;S&gt;.unique/value_counts/round/dropna().</span>
<pre><code class="python language-python hljs">&lt;S&gt; = &lt;S&gt;.head/describe/sort_values() <span class="hljs-comment"># Also &lt;S&gt;.unique/value_counts/round/dropna().</span>
&lt;S&gt; = &lt;S&gt;.str.strip/lower/contains/replace() <span class="hljs-comment"># Also split().str[&lt;int&gt;] and split().explode().</span>
&lt;S&gt; = &lt;S&gt;.dt.year/month/day/hour <span class="hljs-comment"># Use pd.to_datetime(&lt;S&gt;) to get S of dates.</span>
</code></pre>
<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>Also: <code class="python hljs"><span class="hljs-string">'pd.cut(&lt;S&gt;, bins=&lt;int/coll&gt;)'</span></code>, <code class="python hljs"><span class="hljs-string">'&lt;S&gt;.quantile(&lt;float/coll&gt;)'</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>
@ -2627,7 +2628,6 @@ Name: a, dtype: int64
</code></pre>
<ul>
<li><strong>Methods sort_values(), dropna(), ffill(), interpolate() and fillna() accept <code class="python hljs"><span class="hljs-string">'inplace=True'</span></code>.</strong></li>
<li><strong>Agg() and transform() pass a Series to a function if it raises Type/Val/AttrError on a scalar.</strong></li>
<li><strong>Last result has a multi-index. Use <code class="python hljs"><span class="hljs-string">'&lt;S&gt;[key_1, key_2]'</span></code> to get its values.</strong></li>
</ul>

Loading…
Cancel
Save