@ -2538,9 +2538,10 @@ W, H, MAX_S = <span class="hljs-number">50</span>, <span class="hljs-number">50<
main()
< / code > < / pre > < / div >
< div > < h2 id = "pandas" > < a href = "#pandas" name = "pandas" > #< / a > Pandas< / h2 > < pre > < code class = "python language-python hljs" > < span class = "hljs-comment" > # $ pip3 install pandas< / span >
< div > < h2 id = "pandas" > < a href = "#pandas" name = "pandas" > #< / a > Pandas< / h2 > < pre > < code class = "python language-python hljs" > < span class = "hljs-comment" > # $ pip3 install pandas matplotlib < / span >
< span class = "hljs-keyword" > import< / span > pandas < span class = "hljs-keyword" > as< / span > pd
< span class = "hljs-keyword" > from< / span > pandas < span class = "hljs-keyword" > import< / span > Series, DataFrame
< span class = "hljs-keyword" > import< / span > matplotlib.pyplot < span class = "hljs-keyword" > as< / span > plt
< / code > < / pre > < / div >
< div > < h3 id = "series" > Series< / h3 > < p > < strong > Ordered dictionary with a name.< / strong > < / p > < pre > < code class = "python language-python hljs" > < span class = "hljs-meta" > > > > < / span > Series([< span class = "hljs-number" > 1< / span > , < span class = "hljs-number" > 2< / span > ], index=[< span class = "hljs-string" > 'x'< / span > , < span class = "hljs-string" > 'y'< / span > ], name=< span class = "hljs-string" > 'a'< / span > )
@ -2570,7 +2571,7 @@ Name: a, dtype: int64
< Sr> .update(< Sr> ) < span class = "hljs-comment" > # Updates items that are already present.< / span >
< / code > < / pre >
< pre > < code class = "python language-python hljs" > < Sr> .plot.line/area/bar/pie/hist() < span class = "hljs-comment" > # Generates a Matplotlib plot.< / span >
mat plotlib.pyplo t.show() < span class = "hljs-comment" > # Displays the plot. Also savefig(< path> ).< / span >
plt.show() < span class = "hljs-comment" > # Displays the plot. Also plt. savefig(< path> ).< / span >
< / code > < / pre >
< div > < h4 id = "seriesaggregatetransformmap" > Series — Aggregate, Transform, Map:< / h4 > < pre > < code class = "python language-python hljs" > < el> = < Sr> .sum/max/mean/idxmax/all() < span class = "hljs-comment" > # Or: < Sr> .agg(lambda < Sr> : < el> )< / span >
< Sr> = < Sr> .rank/diff/cumsum/ffill/interpl() < span class = "hljs-comment" > # Or: < Sr> .agg/transform(lambda < Sr> : < Sr> )< / span >
@ -2701,11 +2702,11 @@ b <span class="hljs-number">3</span> <span class="hljs-number">4</span>
< ul >
< li > < strong > Use < code class = "python hljs" > < span class = "hljs-string" > '< DF> [col_key_1, col_key_2][row_key]'< / span > < / code > to get the fifth result's values.< / strong > < / li >
< / ul >
< div > < h4 id = "dataframeplotencodedecode" > DataFrame — Plot, Encode, Decode:< / h4 > < pre > < code class = "python language-python hljs" > < DF> .plot.line/bar/hist/scatter() < span class = "hljs-comment" > # Also: `x=column_key, y=column_key/s`.< / span >
< span class = "hljs-keyword" > import< / span > matplotlib.pyplot < span class = "hljs-keyword" > as< / span > plt; plt.show() < span class = "hljs-comment" > # Displays the plot .< / span >
< div > < h4 id = "dataframeplotencodedecode" > DataFrame — Plot, Encode, Decode:< / h4 > < pre > < code class = "python language-python hljs" > < DF> .plot.line/bar/hist/scatter/box () < span class = "hljs-comment" > # Also: `x=column_key, y=column_key/s`.< / span >
plt.show() < span class = "hljs-comment" > # Displays the plot. Also plt.savefig(< path> ) .< / span >
< / code > < / pre > < / div >
< pre > < code class = "python language-python hljs" > < DF> = pd.read_json/html(< span class = "hljs-string" > '< str/path/url> '< / span > ) < span class = "hljs-comment" > # Run `$ pip3 install lxml` to read html .< / span >
< pre > < code class = "python language-python hljs" > < DF> = pd.read_json/html(< span class = "hljs-string" > '< str/path/url> '< / span > ) < span class = "hljs-comment" > # Run `$ pip3 install beautifulsoup4 lxml` .< / span >
< DF> = pd.read_csv/pickle/excel(< span class = "hljs-string" > '< path/url> '< / span > ) < span class = "hljs-comment" > # Use `sheet_name=None` to get all Excel sheets.< / span >
< DF> = pd.read_sql(< span class = "hljs-string" > '< table/query> '< / span > , < conn.> ) < span class = "hljs-comment" > # Accepts SQLite3 or SQLAlchemy connection.< / span >
< DF> = pd.read_clipboard() < span class = "hljs-comment" > # Reads a copied table from the clipboard.< / span >