Browse Source

Pandas

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

6
README.md

@ -3164,8 +3164,8 @@ Name: a, dtype: int64
```
```python
<S> = pd.Series(<list>) # Creates index from list's indices.
<S> = pd.Series(<dict>) # Creates index from dictionary's keys.
<S> = pd.Series(<list>) # Uses list's indices for 'index'.
<S> = pd.Series(<dict>) # Uses dictionary's keys for 'index'.
```
```python
@ -3365,7 +3365,7 @@ c 6 7
<DF>.to_pickle/excel(<path>) # Run `$ pip3 install "pandas[excel]" odfpy`.
<DF>.to_sql('<table_name>', <connection>) # Also `if_exists='fail/replace/append'`.
```
* **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.**
* **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.**
* **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.**
* **To get specific attributes from a series of Timestamps use `'<S>.dt.year/date/…'`.**

10
index.html

@ -55,7 +55,7 @@
<body>
<header>
<aside>December 5, 2024</aside>
<aside>December 6, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -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"># 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>
<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>
&lt;S&gt; = pd.Series(&lt;dict&gt;) <span class="hljs-comment"># Uses dictionary's keys for '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>
&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 @@ c <span class="hljs-number">6</span> <span class="hljs-number">7</span>
&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>
</code></pre>
<ul>
<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>
<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>
<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>
<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>
</ul>
@ -2924,7 +2924,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active
<footer>
<aside>December 5, 2024</aside>
<aside>December 6, 2024</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save