Browse Source

Pandas

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

6
README.md

@ -1918,7 +1918,7 @@ with <conn>: # Exits the block with commit() o
<conn>.execute('<query>', <dict/namedtuple>) # Replaces ':<key>'s with values. <conn>.execute('<query>', <dict/namedtuple>) # Replaces ':<key>'s with values.
<conn>.executemany('<query>', <coll_of_coll>) # Runs execute() multiple times. <conn>.executemany('<query>', <coll_of_coll>) # Runs execute() multiple times.
``` ```
* **Passed values can be of type str, int, float, bytes, None, or bool (stored as 1 or 0).**
* **Passed values can be of type str, int, float, bytes, None, or bool (stored as 0 or 1).**
### Example ### Example
**Values are not actually saved in this example because `'conn.commit()'` is omitted!** **Values are not actually saved in this example because `'conn.commit()'` is omitted!**
@ -2835,7 +2835,7 @@ from PIL import ImageDraw
<Draw>.rectangle((x1, y1, x2, y2)) # Also rounded_rectangle(), regular_polygon(). <Draw>.rectangle((x1, y1, x2, y2)) # Also rounded_rectangle(), regular_polygon().
<Draw>.polygon((x1, y1, x2, y2, ...)) # Last point gets connected to the first. <Draw>.polygon((x1, y1, x2, y2, ...)) # Last point gets connected to the first.
<Draw>.ellipse((x1, y1, x2, y2)) # To rotate use Image's rotate() and paste(). <Draw>.ellipse((x1, y1, x2, y2)) # To rotate use Image's rotate() and paste().
<Draw>.text((x, y), <str>, font=<Font>) # `<Font> = ImageFont.truetype(<path>, size)`
<Draw>.text((x, y), <str>, font=<Font>) # `<Font> = ImageFont.truetype(<path>, size)`.
``` ```
* **Use `'fill=<color>'` to set the primary color.** * **Use `'fill=<color>'` to set the primary color.**
* **Use `'width=<int>'` to set the width of lines or contours.** * **Use `'width=<int>'` to set the width of lines or contours.**
@ -3348,7 +3348,7 @@ c 6 7
<DF> = <DF>.xs(row_keys, level=<ints>) # Rows that have first key on first level, etc. <DF> = <DF>.xs(row_keys, level=<ints>) # Rows that have first key on first level, etc.
<DF> = <DF>.set_index(col_keys) # Combines multiple columns into a multi-index. <DF> = <DF>.set_index(col_keys) # Combines multiple columns into a multi-index.
<S/DF> = <DF>.stack/unstack(level=-1) # Combines col keys with row keys or vice versa. <S/DF> = <DF>.stack/unstack(level=-1) # Combines col keys with row keys or vice versa.
<DF> = <DF>.pivot_table(index=col_key/s, …) # `columns=key/s, values=key/s, aggfunc='mean'`.
<DF> = <DF>.pivot_table(index=col_key/s) # `columns=key/s, values=key/s, aggfunc='mean'`.
``` ```
#### DataFrame — Encode, Decode: #### DataFrame — Encode, Decode:

6
index.html

@ -1587,7 +1587,7 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-
</code></pre></div> </code></pre></div>
<ul> <ul>
<li><strong>Passed values can be of type str, int, float, bytes, None, or bool (stored as 1 or 0).</strong></li>
<li><strong>Passed values can be of type str, int, float, bytes, None, or bool (stored as 0 or 1).</strong></li>
</ul> </ul>
<div><h3 id="example-1">Example</h3><p><strong>Values are not actually saved in this example because <code class="python hljs"><span class="hljs-string">'conn.commit()'</span></code> is omitted!</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>conn = sqlite3.connect(<span class="hljs-string">'test.db'</span>) <div><h3 id="example-1">Example</h3><p><strong>Values are not actually saved in this example because <code class="python hljs"><span class="hljs-string">'conn.commit()'</span></code> is omitted!</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>conn = sqlite3.connect(<span class="hljs-string">'test.db'</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>conn.execute(<span class="hljs-string">'CREATE TABLE person (person_id INTEGER PRIMARY KEY, name, height)'</span>) <span class="hljs-meta">&gt;&gt;&gt; </span>conn.execute(<span class="hljs-string">'CREATE TABLE person (person_id INTEGER PRIMARY KEY, name, height)'</span>)
@ -2308,7 +2308,7 @@ img.show()
&lt;Draw&gt;.rectangle((x1, y1, x2, y2)) <span class="hljs-comment"># Also rounded_rectangle(), regular_polygon().</span> &lt;Draw&gt;.rectangle((x1, y1, x2, y2)) <span class="hljs-comment"># Also rounded_rectangle(), regular_polygon().</span>
&lt;Draw&gt;.polygon((x1, y1, x2, y2, ...)) <span class="hljs-comment"># Last point gets connected to the first.</span> &lt;Draw&gt;.polygon((x1, y1, x2, y2, ...)) <span class="hljs-comment"># Last point gets connected to the first.</span>
&lt;Draw&gt;.ellipse((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use Image's rotate() and paste().</span> &lt;Draw&gt;.ellipse((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use Image's rotate() and paste().</span>
&lt;Draw&gt;.text((x, y), &lt;str&gt;, font=&lt;Font&gt;) <span class="hljs-comment"># `&lt;Font&gt; = ImageFont.truetype(&lt;path&gt;, size)`</span>
&lt;Draw&gt;.text((x, y), &lt;str&gt;, font=&lt;Font&gt;) <span class="hljs-comment"># `&lt;Font&gt; = ImageFont.truetype(&lt;path&gt;, size)`.</span>
</code></pre></div> </code></pre></div>
<ul> <ul>
@ -2726,7 +2726,7 @@ c <span class="hljs-number">6</span> <span class="hljs-number">7</span>
&lt;DF&gt; = &lt;DF&gt;.xs(row_keys, level=&lt;ints&gt;) <span class="hljs-comment"># Rows that have first key on first level, etc.</span> &lt;DF&gt; = &lt;DF&gt;.xs(row_keys, level=&lt;ints&gt;) <span class="hljs-comment"># Rows that have first key on first level, etc.</span>
&lt;DF&gt; = &lt;DF&gt;.set_index(col_keys) <span class="hljs-comment"># Combines multiple columns into a multi-index.</span> &lt;DF&gt; = &lt;DF&gt;.set_index(col_keys) <span class="hljs-comment"># Combines multiple columns into a multi-index.</span>
&lt;S/DF&gt; = &lt;DF&gt;.stack/unstack(level=<span class="hljs-number">-1</span>) <span class="hljs-comment"># Combines col keys with row keys or vice versa.</span> &lt;S/DF&gt; = &lt;DF&gt;.stack/unstack(level=<span class="hljs-number">-1</span>) <span class="hljs-comment"># Combines col keys with row keys or vice versa.</span>
&lt;DF&gt; = &lt;DF&gt;.pivot_table(index=col_key/s, …) <span class="hljs-comment"># `columns=key/s, values=key/s, aggfunc='mean'`.</span>
&lt;DF&gt; = &lt;DF&gt;.pivot_table(index=col_key/s) <span class="hljs-comment"># `columns=key/s, values=key/s, aggfunc='mean'`.</span>
</code></pre></div> </code></pre></div>
<div><h4 id="dataframeencodedecode">DataFrame — Encode, Decode:</h4><pre><code class="python language-python hljs">&lt;DF&gt; = pd.read_json/html(<span class="hljs-string">'&lt;str/path/url&gt;'</span>) <span class="hljs-comment"># Run `$ pip3 install beautifulsoup4 lxml`.</span> <div><h4 id="dataframeencodedecode">DataFrame — Encode, Decode:</h4><pre><code class="python language-python hljs">&lt;DF&gt; = pd.read_json/html(<span class="hljs-string">'&lt;str/path/url&gt;'</span>) <span class="hljs-comment"># Run `$ pip3 install beautifulsoup4 lxml`.</span>

Loading…
Cancel
Save