Browse Source

Pandas

pull/57/head
Jure Šorn 4 years ago
parent
commit
d3fec31d51
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -3182,7 +3182,7 @@ b 3 4
<DF> = <DF>.set_index(column_key) # Replaces row keys with values from a column. <DF> = <DF>.set_index(column_key) # Replaces row keys with values from a column.
<DF> = <DF>.reset_index() # Moves row keys to their own column. <DF> = <DF>.reset_index() # Moves row keys to their own column.
<DF> = <DF>.filter('<regex>', axis=1) # Only keeps columns whose key matches the regex. <DF> = <DF>.filter('<regex>', axis=1) # Only keeps columns whose key matches the regex.
<DF> = <DF>.melt(id_vars=column_key/s) # Convers DF from wide to long format.
<DF> = <DF>.melt(id_vars=column_key/s) # Converts DF from wide to long format.
``` ```
#### Merge, Join, Concat: #### Merge, Join, Concat:

2
index.html

@ -2708,7 +2708,7 @@ b <span class="hljs-number">3</span> <span class="hljs-number">4</span>
<pre><code class="python language-python hljs">&lt;DF&gt; = &lt;DF&gt;.set_index(column_key) <span class="hljs-comment"># Replaces row keys with values from a column.</span> <pre><code class="python language-python hljs">&lt;DF&gt; = &lt;DF&gt;.set_index(column_key) <span class="hljs-comment"># Replaces row keys with values from a column.</span>
&lt;DF&gt; = &lt;DF&gt;.reset_index() <span class="hljs-comment"># Moves row keys to their own column.</span> &lt;DF&gt; = &lt;DF&gt;.reset_index() <span class="hljs-comment"># Moves row keys to their own column.</span>
&lt;DF&gt; = &lt;DF&gt;.filter(<span class="hljs-string">'&lt;regex&gt;'</span>, axis=<span class="hljs-number">1</span>) <span class="hljs-comment"># Only keeps columns whose key matches the regex.</span> &lt;DF&gt; = &lt;DF&gt;.filter(<span class="hljs-string">'&lt;regex&gt;'</span>, axis=<span class="hljs-number">1</span>) <span class="hljs-comment"># Only keeps columns whose key matches the regex.</span>
&lt;DF&gt; = &lt;DF&gt;.melt(id_vars=column_key/s) <span class="hljs-comment"># Convers DF from wide to long format.</span>
&lt;DF&gt; = &lt;DF&gt;.melt(id_vars=column_key/s) <span class="hljs-comment"># Converts DF from wide to long format.</span>
</code></pre> </code></pre>
<div><h4 id="mergejoinconcat">Merge, Join, Concat:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>l = 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>]) <div><h4 id="mergejoinconcat">Merge, Join, Concat:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>l = 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>])
x y x y

Loading…
Cancel
Save