Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e78169d

Browse files
committed
Open, Series
1 parent 4c3bfcd commit e78169d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ import re
381381
* **By default, decimal characters, alphanumerics and whitespaces from all alphabets are matched unless `'flags=re.ASCII'` argument is used.**
382382
* **As shown below, it restricts special sequence matches to the first 128 characters and prevents `'\s'` from accepting `'[\x1c-\x1f]'` (the so-called separator characters).**
383383
* **Use a capital letter for negation.**
384+
384385
```python
385386
'\d' == '[0-9]' # Matches decimal characters.
386387
'\w' == '[a-zA-Z0-9_]' # Matches alphanumerics and underscore.
@@ -1548,7 +1549,7 @@ Open
15481549
```
15491550
* **`'encoding=None'` means that the default encoding is used, which is platform dependent. Best practice is to use `'encoding="utf-8"'` whenever possible.**
15501551
* **`'newline=None'` means all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to system's default line separator.**
1551-
* **`'newline=""'` means no conversions take place, but input is still broken into chunks by readline() and readlines() on '\n', '\r' and '\r\n'.**
1552+
* **`'newline=""'` means no conversions take place, but input is still broken into chunks by readline() and readlines() on every '\n', '\r' and '\r\n'.**
15521553

15531554
### Modes
15541555
* **`'r'` - Read (default).**
@@ -1898,8 +1899,7 @@ with <conn>: # Exits the block with commit()
18981899
```
18991900

19001901
### Example
1901-
**In this example values are not actually saved because `'conn.commit()'` is omitted!**
1902-
1902+
**Values are not actually saved in this example because `'conn.commit()'` is omitted!**
19031903
```python
19041904
>>> conn = sqlite3.connect('test.db')
19051905
>>> conn.execute('CREATE TABLE person (person_id INTEGER PRIMARY KEY, name, height)')
@@ -3147,7 +3147,6 @@ Name: a, dtype: int64
31473147
<Sr> = <Sr>.rank/diff/cumsum/ffill/interpl() # Or: <Sr>.agg/transform(lambda <Sr>: <Sr>)
31483148
<Sr> = <Sr>.fillna(<el>) # Or: <Sr>.agg/transform/map(lambda <el>: <el>)
31493149
```
3150-
* **The way `'agg()'` and `'transform()'` find out whether the passed function accepts an element or the whole Series is by passing it a single value at first and if it raises an error, then they pass it the whole Series. `'agg()'` only accepts Attribute/Type/ValueError.**
31513150

31523151
```python
31533152
>>> sr = Series([1, 2], index=['x', 'y'])
@@ -3173,6 +3172,12 @@ y 2
31733172
```
31743173
* **Last result has a hierarchical index. Use `'<Sr>[key_1, key_2]'` to get its values.**
31753174

3175+
#### Series — Plot:
3176+
```python
3177+
import matplotlib.pyplot as plt
3178+
<Sr>.plot.line/area/bar/pie/hist(); plt.show()
3179+
```
3180+
31763181
### DataFrame
31773182
**Table with labeled rows and columns.**
31783183

index.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<body>
5656
<header>
57-
<aside>March 3, 2022</aside>
57+
<aside>March 8, 2022</aside>
5858
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
5959
</header>
6060

@@ -1319,7 +1319,7 @@
13191319
<ul>
13201320
<li><strong><code class="python hljs"><span class="hljs-string">'encoding=None'</span></code> means that the default encoding is used, which is platform dependent. Best practice is to use <code class="python hljs"><span class="hljs-string">'encoding="utf-8"'</span></code> whenever possible.</strong></li>
13211321
<li><strong><code class="python hljs"><span class="hljs-string">'newline=None'</span></code> means all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to system's default line separator.</strong></li>
1322-
<li><strong><code class="python hljs"><span class="hljs-string">'newline=""'</span></code> means no conversions take place, but input is still broken into chunks by readline() and readlines() on '\n', '\r' and '\r\n'.</strong></li>
1322+
<li><strong><code class="python hljs"><span class="hljs-string">'newline=""'</span></code> means no conversions take place, but input is still broken into chunks by readline() and readlines() on every '\n', '\r' and '\r\n'.</strong></li>
13231323
</ul>
13241324
<div><h3 id="modes">Modes</h3><ul>
13251325
<li><strong><code class="python hljs"><span class="hljs-string">'r'</span></code> - Read (default).</strong></li>
@@ -1577,7 +1577,7 @@
15771577
</code></pre></div>
15781578

15791579

1580-
<div><h3 id="example">Example</h3><p><strong>In this example values are not actually saved 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>)
1580+
<div><h3 id="example">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>)
15811581
<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>)
15821582
<span class="hljs-meta">&gt;&gt;&gt; </span>conn.execute(<span class="hljs-string">'INSERT INTO person VALUES (NULL, ?, ?)'</span>, (<span class="hljs-string">'Jean-Luc'</span>, <span class="hljs-number">187</span>)).lastrowid
15831583
<span class="hljs-number">1</span>
@@ -2555,9 +2555,6 @@
25552555
&lt;Sr&gt; = &lt;Sr&gt;.fillna(&lt;el&gt;) <span class="hljs-comment"># Or: &lt;Sr&gt;.agg/transform/map(lambda &lt;el&gt;: &lt;el&gt;)</span>
25562556
</code></pre></div>
25572557

2558-
<ul>
2559-
<li><strong>The way <code class="python hljs"><span class="hljs-string">'agg()'</span></code> and <code class="python hljs"><span class="hljs-string">'transform()'</span></code> find out whether the passed function accepts an element or the whole Series is by passing it a single value at first and if it raises an error, then they pass it the whole Series. <code class="python hljs"><span class="hljs-string">'agg()'</span></code> only accepts Attribute/Type/ValueError.</strong></li>
2560-
</ul>
25612558
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>sr = Series([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], index=[<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>])
25622559
x <span class="hljs-number">1</span>
25632560
y <span class="hljs-number">2</span>
@@ -2580,6 +2577,10 @@
25802577
<ul>
25812578
<li><strong>Last result has a hierarchical index. Use <code class="python hljs"><span class="hljs-string">'&lt;Sr&gt;[key_1, key_2]'</span></code> to get its values.</strong></li>
25822579
</ul>
2580+
<div><h4 id="seriesplot">Series — Plot:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
2581+
&lt;Sr&gt;.plot.line/area/bar/pie/hist(); plt.show()
2582+
</code></pre></div>
2583+
25832584
<div><h3 id="dataframe">DataFrame</h3><p><strong>Table with labeled rows and columns.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>DataFrame([[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], index=[<span class="hljs-string">'a'</span>, <span class="hljs-string">'b'</span>], columns=[<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>])
25842585
x y
25852586
a <span class="hljs-number">1</span> <span class="hljs-number">2</span>
@@ -2884,7 +2885,7 @@
28842885

28852886

28862887
<footer>
2887-
<aside>March 3, 2022</aside>
2888+
<aside>March 8, 2022</aside>
28882889
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
28892890
</footer>
28902891

0 commit comments

Comments
 (0)