Browse Source

Pandas

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

8
README.md

@ -3164,8 +3164,8 @@ Name: a, dtype: int64
```
```python
<S> = pd.Series(<list>) # Assigns RangeIndex starting at 0.
<S> = pd.Series(<dict>) # Takes dictionary's keys for index.
<S> = pd.Series(<list>) # Creates index from list's indices.
<S> = pd.Series(<dict>) # Creates index from dictionary's keys.
<S> = pd.Series(<dict/Series>, index=<list>) # Only keeps items with keys specified in index.
```
@ -3193,7 +3193,7 @@ Name: a, dtype: int64
```
```python
<S>.plot.line/area/bar/pie/hist() # Generates a Matplotlib plot.
<S>.plot.line/area/bar/pie/hist() # Generates a plot. Accepts `title=<str>`.
plt.show() # Displays the plot. Also plt.savefig(<path>).
```
* **Indexing objects can't be tuples because `'obj[x, y]'` is converted to `'obj[(x, y)]'`!**
@ -3269,7 +3269,7 @@ b 3 4
```python
<DF> = <DF>.head/tail/sample(<int>) # Returns first, last, or random n rows.
<DF> = <DF>.describe() # Describes columns. Also shape, info(), corr().
<DF> = <DF>.describe() # Describes columns. Also info(), corr(), shape.
<DF> = <DF>.query('<query>') # Filters rows with e.g. 'col_1 == val_1 and …'.
```

8
index.html

@ -2580,8 +2580,8 @@ Name: a, dtype: int64
</code></pre></div>
<pre><code class="python language-python hljs">&lt;S&gt; = pd.Series(&lt;list&gt;) <span class="hljs-comment"># Assigns RangeIndex starting at 0.</span>
&lt;S&gt; = pd.Series(&lt;dict&gt;) <span class="hljs-comment"># Takes dictionary's keys for index.</span>
<pre><code class="python language-python hljs">&lt;S&gt; = pd.Series(&lt;list&gt;) <span class="hljs-comment"># Creates index from list's indices.</span>
&lt;S&gt; = pd.Series(&lt;dict&gt;) <span class="hljs-comment"># Creates index from dictionary's keys.</span>
&lt;S&gt; = pd.Series(&lt;dict/Series&gt;, index=&lt;list&gt;) <span class="hljs-comment"># Only keeps items with keys specified in index.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;el&gt; = &lt;S&gt;.loc[key] <span class="hljs-comment"># Or: &lt;S&gt;.iloc[i]</span>
@ -2599,7 +2599,7 @@ Name: a, dtype: int64
&lt;S&gt; = &lt;S&gt;.combine_first(&lt;S&gt;) <span class="hljs-comment"># Adds items that are not yet present.</span>
&lt;S&gt;.update(&lt;S&gt;) <span class="hljs-comment"># Updates items that are already present.</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 Matplotlib plot.</span>
<pre><code class="python language-python hljs">&lt;S&gt;.plot.line/area/bar/pie/hist() <span class="hljs-comment"># Generates a plot. Accepts `title=&lt;str&gt;`.</span>
plt.show() <span class="hljs-comment"># Displays the plot. Also plt.savefig(&lt;path&gt;).</span>
</code></pre>
<ul>
@ -2659,7 +2659,7 @@ b <span class="hljs-number">3</span> <span class="hljs-number">4</span>
&lt;DF&gt; = &lt;DF&gt;.sort_values(col_key/s) <span class="hljs-comment"># Sorts rows by passed column/s. Also `axis=1`.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;DF&gt; = &lt;DF&gt;.head/tail/sample(&lt;int&gt;) <span class="hljs-comment"># Returns first, last, or random n rows.</span>
&lt;DF&gt; = &lt;DF&gt;.describe() <span class="hljs-comment"># Describes columns. Also shape, info(), corr().</span>
&lt;DF&gt; = &lt;DF&gt;.describe() <span class="hljs-comment"># Describes columns. Also info(), corr(), shape.</span>
&lt;DF&gt; = &lt;DF&gt;.query(<span class="hljs-string">'&lt;query&gt;'</span>) <span class="hljs-comment"># Filters rows with e.g. 'col_1 == val_1 and …'.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;DF&gt;.plot.line/area/bar/scatter(x=col_key, …) <span class="hljs-comment"># `y=col_key/s`. Also hist/box(by=col_key).</span>

Loading…
Cancel
Save