Skip to content

Commit 6d85e2b

Browse files
committed
Pandas
1 parent 449b7cf commit 6d85e2b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,8 +3164,8 @@ Name: a, dtype: int64
31643164
```
31653165

31663166
```python
3167-
<S> = pd.Series(<list>) # Creates index from list's indices.
3168-
<S> = pd.Series(<dict>) # Creates index from dictionary's keys.
3167+
<S> = pd.Series(<list>) # Uses list's indices for 'index'.
3168+
<S> = pd.Series(<dict>) # Uses dictionary's keys for 'index'.
31693169
```
31703170

31713171
```python
@@ -3365,7 +3365,7 @@ c 6 7
33653365
<DF>.to_pickle/excel(<path>) # Run `$ pip3 install "pandas[excel]" odfpy`.
33663366
<DF>.to_sql('<table_name>', <connection>) # Also `if_exists='fail/replace/append'`.
33673367
```
3368-
* **Read\_csv() only parses dates of columns that were specified by 'parse\_dates' argument. It automatically tries to detect the format, but it can be helped with 'date\_format' or 'datefirst' arguments. Both dates and datetimes get stored as pd.Timestamp objects.**
3368+
* **Read\_csv() only parses dates of columns that were specified by 'parse\_dates' argument. It automatically tries to detect the format, but it can be helped with 'date\_format' or 'datefirst' arguments. Both dates and datetimes get stored as pd.Timestamp objects.**
33693369
* **If there's a single invalid date then it returns the whole column as a series of strings, unlike `'<S> = pd.to_datetime(<S>, errors="coerce")'`, which uses pd.NaT.**
33703370
* **To get specific attributes from a series of Timestamps use `'<S>.dt.year/date/…'`.**
33713371

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<body>
5757
<header>
58-
<aside>December 5, 2024</aside>
58+
<aside>December 6, 2024</aside>
5959
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
6060
</header>
6161

@@ -2580,8 +2580,8 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
25802580
</code></pre></div>
25812581

25822582

2583-
<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>
2584-
&lt;S&gt; = pd.Series(&lt;dict&gt;) <span class="hljs-comment"># Creates index from dictionary's keys.</span>
2583+
<pre><code class="python language-python hljs">&lt;S&gt; = pd.Series(&lt;list&gt;) <span class="hljs-comment"># Uses list's indices for 'index'.</span>
2584+
&lt;S&gt; = pd.Series(&lt;dict&gt;) <span class="hljs-comment"># Uses dictionary's keys for 'index'.</span>
25852585
</code></pre>
25862586
<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>
25872587
&lt;S&gt; = &lt;S&gt;.loc[coll_of_keys] <span class="hljs-comment"># Or: &lt;S&gt;.iloc[coll_of_i]</span>
@@ -2741,7 +2741,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
27412741
&lt;DF&gt;.to_sql(<span class="hljs-string">'&lt;table_name&gt;'</span>, &lt;connection&gt;) <span class="hljs-comment"># Also `if_exists='fail/replace/append'`.</span>
27422742
</code></pre>
27432743
<ul>
2744-
<li><strong>Read_csv() only parses dates of columns that were specified by 'parse_dates' argument. It automatically tries to detect the format, but it can be helped with 'date_format' or 'datefirst' arguments. Both dates and datetimes get stored as pd.Timestamp objects.</strong></li>
2744+
<li><strong>Read_csv() only parses dates of columns that were specified by 'parse_dates' argument. It&nbsp;automatically tries to detect the format, but it can be helped with 'date_format' or 'datefirst' arguments. Both dates and datetimes get stored as pd.Timestamp objects.</strong></li>
27452745
<li><strong>If there's a single invalid date then it returns the whole column as a series of strings, unlike <code class="python hljs"><span class="hljs-string">'&lt;S&gt; = pd.to_datetime(&lt;S&gt;, errors="coerce")'</span></code>, which uses pd.NaT.</strong></li>
27462746
<li><strong>To get specific attributes from a series of Timestamps use <code class="python hljs"><span class="hljs-string">'&lt;S&gt;.dt.year/date/…'</span></code>.</strong></li>
27472747
</ul>
@@ -2924,7 +2924,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29242924

29252925

29262926
<footer>
2927-
<aside>December 5, 2024</aside>
2927+
<aside>December 6, 2024</aside>
29282928
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29292929
</footer>
29302930

0 commit comments

Comments
 (0)