Browse Source

Pandas

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

6
README.md

@ -3352,16 +3352,16 @@ c 6 7
### File Formats ### File Formats
```python ```python
<S/DF> = pd.read_json/pickle(<path/url/file>) # Also accepts io.StringIO/BytesIO(<str/bytes>).
<S/DF> = pd.read_json/pickle(<path/url/file>) # Also io.StringIO(<str>), io.BytesIO(<bytes>).
<DF> = pd.read_csv/excel(<path/url/file>) # Also `header/index_col/dtype/usecols/…=<obj>`. <DF> = pd.read_csv/excel(<path/url/file>) # Also `header/index_col/dtype/usecols/…=<obj>`.
<list> = pd.read_html(<path/url/file>) # Raises ImportError if webpage has zero tables. <list> = pd.read_html(<path/url/file>) # Raises ImportError if webpage has zero tables.
<S/DF> = pd.read_parquet/feather/hdf(<path>) # Read_hdf() accepts `key='<df_name>'` argument.
<S/DF> = pd.read_parquet/feather/hdf(<path>) # Read_hdf() accepts `key=<s/df_name>` argument.
<DF> = pd.read_sql('<table/query>', <conn>) # Pass SQLite3/Alchemy connection (see #SQLite). <DF> = pd.read_sql('<table/query>', <conn>) # Pass SQLite3/Alchemy connection (see #SQLite).
``` ```
```python ```python
<DF>.to_json/csv/html/parquet/latex(<path>) # Returns a string/bytes if path is omitted. <DF>.to_json/csv/html/parquet/latex(<path>) # Returns a string/bytes if path is omitted.
<DF>.to_pickle/excel/feather/hdf(<path>) # To_hdf() requires `key='<df_name>'` argument.
<DF>.to_pickle/excel/feather/hdf(<path>) # To_hdf() requires `key=<s/df_name>` argument.
<DF>.to_sql('<table_name>', <connection>) # Also `if_exists='fail/replace/append'`. <DF>.to_sql('<table_name>', <connection>) # Also `if_exists='fail/replace/append'`.
``` ```
* **`'$ pip3 install "pandas[excel]" odfpy lxml pyarrow'` installs dependencies.** * **`'$ pip3 install "pandas[excel]" odfpy lxml pyarrow'` installs dependencies.**

10
index.html

@ -55,7 +55,7 @@
<body> <body>
<header> <header>
<aside>February 3, 2025</aside>
<aside>February 4, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header> </header>
@ -2729,15 +2729,15 @@ c <span class="hljs-number">6</span> <span class="hljs-number">7</span>
&lt;S&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&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>
</code></pre></div> </code></pre></div>
<div><h3 id="fileformats">File Formats</h3><pre><code class="python language-python hljs">&lt;S/DF&gt; = pd.read_json/pickle(&lt;path/url/file&gt;) <span class="hljs-comment"># Also accepts io.StringIO/BytesIO(&lt;str/bytes&gt;).</span>
<div><h3 id="fileformats">File Formats</h3><pre><code class="python language-python hljs">&lt;S/DF&gt; = pd.read_json/pickle(&lt;path/url/file&gt;) <span class="hljs-comment"># Also io.StringIO(&lt;str&gt;), io.BytesIO(&lt;bytes&gt;).</span>
&lt;DF&gt; = pd.read_csv/excel(&lt;path/url/file&gt;) <span class="hljs-comment"># Also `header/index_col/dtype/usecols/…=&lt;obj&gt;`.</span> &lt;DF&gt; = pd.read_csv/excel(&lt;path/url/file&gt;) <span class="hljs-comment"># Also `header/index_col/dtype/usecols/…=&lt;obj&gt;`.</span>
&lt;list&gt; = pd.read_html(&lt;path/url/file&gt;) <span class="hljs-comment"># Raises ImportError if webpage has zero tables.</span> &lt;list&gt; = pd.read_html(&lt;path/url/file&gt;) <span class="hljs-comment"># Raises ImportError if webpage has zero tables.</span>
&lt;S/DF&gt; = pd.read_parquet/feather/hdf(&lt;path…&gt;) <span class="hljs-comment"># Read_hdf() accepts `key='&lt;df_name&gt;'` argument.</span>
&lt;S/DF&gt; = pd.read_parquet/feather/hdf(&lt;path…&gt;) <span class="hljs-comment"># Read_hdf() accepts `key=&lt;s/df_name&gt;` argument.</span>
&lt;DF&gt; = pd.read_sql(<span class="hljs-string">'&lt;table/query&gt;'</span>, &lt;conn&gt;) <span class="hljs-comment"># Pass SQLite3/Alchemy connection (see #SQLite).</span> &lt;DF&gt; = pd.read_sql(<span class="hljs-string">'&lt;table/query&gt;'</span>, &lt;conn&gt;) <span class="hljs-comment"># Pass SQLite3/Alchemy connection (see #SQLite).</span>
</code></pre></div> </code></pre></div>
<pre><code class="python language-python hljs">&lt;DF&gt;.to_json/csv/html/parquet/latex(&lt;path&gt;) <span class="hljs-comment"># Returns a string/bytes if path is omitted.</span> <pre><code class="python language-python hljs">&lt;DF&gt;.to_json/csv/html/parquet/latex(&lt;path&gt;) <span class="hljs-comment"># Returns a string/bytes if path is omitted.</span>
&lt;DF&gt;.to_pickle/excel/feather/hdf(&lt;path&gt;) <span class="hljs-comment"># To_hdf() requires `key='&lt;df_name&gt;'` argument.</span>
&lt;DF&gt;.to_pickle/excel/feather/hdf(&lt;path&gt;) <span class="hljs-comment"># To_hdf() requires `key=&lt;s/df_name&gt;` argument.</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> &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> </code></pre>
<ul> <ul>
@ -2931,7 +2931,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active
<footer> <footer>
<aside>February 3, 2025</aside>
<aside>February 4, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer> </footer>

Loading…
Cancel
Save