@ -2616,16 +2615,17 @@ y <span class="hljs-number">2</span>
<ul>
<li><strong>Methods ffill(), interpolate() and fillna() accept argument 'inplace' that defaults to False.</strong></li>
<li><strong>Last result has a hierarchical index. Use <codeclass="python hljs"><spanclass="hljs-string">'<Sr>[key_1, key_2]'</span></code> to get its values.</strong></li>
<li><strong>Keys, indexes and bools can't be tuples because <codeclass="python hljs"><spanclass="hljs-string">'obj[x, y]'</span></code> becomes <codeclass="python hljs"><spanclass="hljs-string">'obj[(x, y)]'</span></code>.</strong></li>
</ul>
<div><h3id="dataframe">DataFrame</h3><p><strong>Table with labeled rows and columns.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>], [<spanclass="hljs-number">3</span>, <spanclass="hljs-number">4</span>]], index=[<spanclass="hljs-string">'a'</span>, <spanclass="hljs-string">'b'</span>], columns=[<spanclass="hljs-string">'x'</span>, <spanclass="hljs-string">'y'</span>])
<div><h3id="dataframe">DataFrame</h3><p><strong>Table with labeled rows and columns.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>pd.DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>], [<spanclass="hljs-number">3</span>, <spanclass="hljs-number">4</span>]], index=[<spanclass="hljs-string">'a'</span>, <spanclass="hljs-string">'b'</span>], columns=[<spanclass="hljs-string">'x'</span>, <spanclass="hljs-string">'y'</span>])
x y
a <spanclass="hljs-number">1</span><spanclass="hljs-number">2</span>
b <spanclass="hljs-number">3</span><spanclass="hljs-number">4</span>
</code></pre></div>
<pre><codeclass="python language-python hljs"><DF> = DataFrame(<list_of_rows>)<spanclass="hljs-comment"># Rows can be either lists, dicts or series.</span>
<DF> = DataFrame(<dict_of_columns>)<spanclass="hljs-comment"># Columns can be either lists, dicts or series.</span>
<pre><codeclass="python language-python hljs"><DF> = pd.DataFrame(<list_of_rows>) <spanclass="hljs-comment"># Rows can be either lists, dicts or series.</span>
<DF> = pd.DataFrame(<dict_of_columns>) <spanclass="hljs-comment"># Columns can be either lists, dicts or series.</span>
@ -2644,11 +2644,11 @@ b <span class="hljs-number">3</span> <span class="hljs-number">4</span>
<DF> = <DF>.sort_index(ascending=<spanclass="hljs-keyword">True</span>) <spanclass="hljs-comment"># Sorts rows by row keys. Use `axis=1` for cols.</span>
<DF> = <DF>.sort_values(column_key/s) <spanclass="hljs-comment"># Sorts rows by the passed column/s. Same.</span>
b <spanclass="hljs-number">4</span><spanclass="hljs-number">5</span>
c <spanclass="hljs-number">6</span><spanclass="hljs-number">7</span>
@ -2692,7 +2692,7 @@ c <span class="hljs-number">6</span> <span class="hljs-number">7</span>
<ul>
<li><strong>All operations operate on columns by default. Pass <codeclass="python hljs"><spanclass="hljs-string">'axis=1'</span></code> to process the rows instead.</strong></li>
<DF>.to_pickle/excel(<path>) <spanclass="hljs-comment"># Run `$ pip3 install openpyxl` for xlsx files.</span>
<DF>.to_sql(<spanclass="hljs-string">'<table_name>'</span>, <connection>) <spanclass="hljs-comment"># Accepts SQLite3 or SQLAlchemy connection.</span>
</code></pre>
<div><h3id="groupby">GroupBy</h3><p><strong>Object that groups together rows of a dataframe based on the value of the passed column.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>df = DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">3</span>], [<spanclass="hljs-number">4</span>, <spanclass="hljs-number">5</span>, <spanclass="hljs-number">6</span>], [<spanclass="hljs-number">7</span>, <spanclass="hljs-number">8</span>, <spanclass="hljs-number">6</span>]], index=list(<spanclass="hljs-string">'abc'</span>), columns=list(<spanclass="hljs-string">'xyz'</span>))
<div><h3id="groupby">GroupBy</h3><p><strong>Object that groups together rows of a dataframe based on the value of the passed column.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>df = pd.DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">3</span>], [<spanclass="hljs-number">4</span>, <spanclass="hljs-number">5</span>, <spanclass="hljs-number">6</span>], [<spanclass="hljs-number">7</span>, <spanclass="hljs-number">8</span>, <spanclass="hljs-number">6</span>]], list(<spanclass="hljs-string">'abc'</span>), list(<spanclass="hljs-string">'xyz'</span>))