diff --git a/README.md b/README.md index 0f9f9c7..d433ec4 100644 --- a/README.md +++ b/README.md @@ -3126,7 +3126,7 @@ y 2 dtype: int64 ``` -```python +```text +-------------+-------------+-------------+---------------+ | | 'sum' | ['sum'] | {'s': 'sum'} | +-------------+-------------+-------------+---------------+ @@ -3135,7 +3135,7 @@ dtype: int64 +-------------+-------------+-------------+---------------+ ``` -```python +```text +-------------+-------------+-------------+---------------+ | | 'rank' | ['rank'] | {'r': 'rank'} | +-------------+-------------+-------------+---------------+ @@ -3197,7 +3197,7 @@ b 4 5 c 6 7 ``` -```python +```text +------------------------+---------------+------------+------------+--------------------------+ | how/join | 'outer' | 'inner' | 'left' | description | +------------------------+---------------+------------+------------+--------------------------+ @@ -3244,7 +3244,7 @@ a 1 2 b 3 4 ``` -```python +```text +-------------+-------------+-------------+---------------+ | | 'sum' | ['sum'] | {'x': 'sum'} | +-------------+-------------+-------------+---------------+ @@ -3254,7 +3254,7 @@ b 3 4 +-------------+-------------+-------------+---------------+ ``` -```python +```text +-------------+-------------+-------------+---------------+ | | 'rank' | ['rank'] | {'x': 'rank'} | +-------------+-------------+-------------+---------------+ @@ -3314,7 +3314,7 @@ c 7 8 c 7 8 6 ``` -```python +```text +-------------+-------------+-------------+-------------+---------------+ | | 'sum' | 'rank' | ['rank'] | {'x': 'rank'} | +-------------+-------------+-------------+-------------+---------------+ @@ -3346,6 +3346,7 @@ Plotly ### Covid Deaths by Continent +
@@ -3368,6 +3369,7 @@ plotly.express.line(summed, x='Date', y='Total Deaths per Million', color='Conti ### Confirmed Covid Cases, Dow Jones, Gold, and Bitcoin Price + ```python diff --git a/index.html b/index.html index bea3475..1fd481a 100644 --- a/index.html +++ b/index.html @@ -2652,19 +2652,19 @@ x 1 y 2 dtype: int64 -+-------------+-------------+-------------+---------------+
-| | 'sum' | ['sum'] | {'s': 'sum'} |
++-------------+-------------+-------------+---------------+
+| | 'sum' | ['sum'] | {'s': 'sum'} |
+-------------+-------------+-------------+---------------+
-| sr.apply(…) | 3 | sum 3 | s 3 |
+| sr.apply(…) | 3 | sum 3 | s 3 |
| sr.agg(…) | | | |
+-------------+-------------+-------------+---------------+
-+-------------+-------------+-------------+---------------+
-| | 'rank' | ['rank'] | {'r': 'rank'} |
++-------------+-------------+-------------+---------------+
+| | 'rank' | ['rank'] | {'r': 'rank'} |
+-------------+-------------+-------------+---------------+
| sr.apply(…) | | rank | |
-| sr.agg(…) | x 1 | x 1 | r x 1 |
-| sr.trans(…) | y 2 | y 2 | y 2 |
+| sr.agg(…) | x 1 | x 1 | r x 1 |
+| sr.trans(…) | y 2 | y 2 | y 2 |
+-------------+-------------+-------------+---------------+
DataFrame
Table with labeled rows and columns.
>>> DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y'])
@@ -2704,34 +2704,34 @@ b 4 5
c 6 7
-+------------------------+---------------+------------+------------+--------------------------+
-| how/join | 'outer' | 'inner' | 'left' | description |
++------------------------+---------------+------------+------------+--------------------------+
+| how/join | 'outer' | 'inner' | 'left' | description |
+------------------------+---------------+------------+------------+--------------------------+
-| l.merge(r, on='y', | x y z | x y z | x y z | Joins/merges on column. |
-| how=…) | 0 1 2 . | 3 4 5 | 1 2 . | Also accepts left_on and |
-| | 1 3 4 5 | | 3 4 5 | right_on parameters. |
-| | 2 . 6 7 | | | Uses 'inner' by default. |
+| l.merge(r, on='y', | x y z | x y z | x y z | Joins/merges on column. |
+| how=…) | 0 1 2 . | 3 4 5 | 1 2 . | Also accepts left_on and |
+| | 1 3 4 5 | | 3 4 5 | right_on parameters. |
+| | 2 . 6 7 | | | Uses 'inner' by default. |
+------------------------+---------------+------------+------------+--------------------------+
-| l.join(r, lsuffix='l', | x yl yr z | | x yl yr z | Joins/merges on row_keys.|
-| rsuffix='r', | a 1 2 . . | x yl yr z | 1 2 . . | Uses 'left' by default. |
-| how=…) | b 3 4 4 5 | 3 4 4 5 | 3 4 4 5 | |
-| | c . . 6 7 | | | |
+| l.join(r, lsuffix='l', | x yl yr z | | x yl yr z | Joins/merges on row_keys.|
+| rsuffix='r', | a 1 2 . . | x yl yr z | 1 2 . . | Uses 'left' by default. |
+| how=…) | b 3 4 4 5 | 3 4 4 5 | 3 4 4 5 | |
+| | c . . 6 7 | | | |
+------------------------+---------------+------------+------------+--------------------------+
| pd.concat([l, r], | x y z | y | | Adds rows at the bottom. |
-| axis=0, | a 1 2 . | 2 | | Uses 'outer' by default. |
-| join=…) | b 3 4 . | 4 | | By default works the |
-| | b . 4 5 | 4 | | same as `l.append(r)`. |
-| | c . 6 7 | 6 | | |
+| axis=0, | a 1 2 . | 2 | | Uses 'outer' by default. |
+| join=…) | b 3 4 . | 4 | | By default works the |
+| | b . 4 5 | 4 | | same as `l.append(r)`. |
+| | c . 6 7 | 6 | | |
+------------------------+---------------+------------+------------+--------------------------+
| pd.concat([l, r], | x y y z | | | Adds columns at the |
-| axis=1, | a 1 2 . . | x y y z | | right end. |
-| join=…) | b 3 4 4 5 | 3 4 4 5 | | Uses 'outer' by default. |
-| | c . . 6 7 | | | |
+| axis=1, | a 1 2 . . | x y y z | | right end. |
+| join=…) | b 3 4 4 5 | 3 4 4 5 | | Uses 'outer' by default. |
+| | c . . 6 7 | | | |
+------------------------+---------------+------------+------------+--------------------------+
-| l.combine_first(r) | x y z | | | Adds missing rows and |
-| | a 1 2 . | | | columns. |
-| | b 3 4 5 | | | |
-| | c . 6 7 | | | |
+| l.combine_first(r) | x y z | | | Adds missing rows and |
+| | a 1 2 . | | | columns. |
+| | b 3 4 5 | | | |
+| | c . 6 7 | | | |
+------------------------+---------------+------------+------------+--------------------------+
Aggregate, Transform, Map:
<Sr> = <DF>.sum/max/mean/idxmax/all() # Or: <DF>.apply/agg/transform(<agg_func>)
@@ -2747,21 +2747,21 @@ c 6 7
a 1 2
b 3 4
-+-------------+-------------+-------------+---------------+
-| | 'sum' | ['sum'] | {'x': 'sum'} |
++-------------+-------------+-------------+---------------+
+| | 'sum' | ['sum'] | {'x': 'sum'} |
+-------------+-------------+-------------+---------------+
| df.apply(…) | | x y | |
-| df.agg(…) | x 4 | sum 4 6 | x 4 |
-| | y 6 | | |
+| df.agg(…) | x 4 | sum 4 6 | x 4 |
+| | y 6 | | |
+-------------+-------------+-------------+---------------+
-+-------------+-------------+-------------+---------------+
-| | 'rank' | ['rank'] | {'x': 'rank'} |
++-------------+-------------+-------------+---------------+
+| | 'rank' | ['rank'] | {'x': 'rank'} |
+-------------+-------------+-------------+---------------+
| df.apply(…) | x y | x y | x |
-| df.agg(…) | a 1 1 | rank rank | a 1 |
-| df.trans(…) | b 2 2 | a 1 1 | b 2 |
-| | | b 2 2 | |
+| df.agg(…) | a 1 1 | rank rank | a 1 |
+| df.trans(…) | b 2 2 | a 1 1 | b 2 |
+| | | b 2 2 | |
+-------------+-------------+-------------+---------------+
Encode, Decode:
<DF> = pd.read_json/html('<str/path/url>')
@@ -2800,19 +2800,19 @@ c 7 8
6: b 4 5 6
c 7 8 6
-+-------------+-------------+-------------+-------------+---------------+
-| | 'sum' | 'rank' | ['rank'] | {'x': 'rank'} |
++-------------+-------------+-------------+-------------+---------------+
+| | 'sum' | 'rank' | ['rank'] | {'x': 'rank'} |
+-------------+-------------+-------------+-------------+---------------+
| gb.agg(…) | x y | x y | x y | x |
-| | z | a 1 1 | rank rank | a 1 |
-| | 3 1 2 | b 1 1 | a 1 1 | b 1 |
-| | 6 11 13 | c 2 2 | b 1 1 | c 2 |
-| | | | c 2 2 | |
+| | z | a 1 1 | rank rank | a 1 |
+| | 3 1 2 | b 1 1 | a 1 1 | b 1 |
+| | 6 11 13 | c 2 2 | b 1 1 | c 2 |
+| | | | c 2 2 | |
+-------------+-------------+-------------+-------------+---------------+
| gb.trans(…) | x y | x y | | |
-| | a 1 2 | a 1 1 | | |
-| | b 11 13 | b 1 1 | | |
-| | c 11 13 | c 1 1 | | |
+| | a 1 2 | a 1 1 | | |
+| | b 11 13 | b 1 1 | | |
+| | c 11 13 | c 1 1 | | |
+-------------+-------------+-------------+-------------+---------------+
Rolling
Object for rolling window calculations.
<R_Sr/R_DF/R_GB> = <Sr/DF/GB>.rolling(window_size) # Also: `min_periods=None, center=False`.
@@ -2821,7 +2821,7 @@ c 7 8
-#Plotly
Covid Deaths by Continent
import pandas as pd
+#Plotly
Covid Deaths by Continent
import pandas as pd
import plotly.express
covid = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv',
@@ -2840,7 +2840,8 @@ plotly.express.line(summed, x='Date', y=Confirmed Covid Cases, Dow Jones, Gold, and Bitcoin Price
import pandas, datetime
+
+Confirmed Covid Cases, Dow Jones, Gold, and Bitcoin Price
import pandas, datetime
import plotly.graph_objects as go
def main():
@@ -2885,6 +2886,7 @@ plotly.express.line(summed, x='Date', y=
+
#Basic Script Template
#!/usr/bin/env python3
#
# Usage: .py
diff --git a/parse.js b/parse.js
index 5a322cf..f6eb05a 100755
--- a/parse.js
+++ b/parse.js
@@ -97,7 +97,8 @@ function modifyPage() {
addToc();
insertLinks();
unindentBanner();
- highlightCode();
+ highlightCode();
+ removePlotImages();
}
function removeOrigToc() {
@@ -202,6 +203,11 @@ function insertPageBreakBefore(an_id) {
$('').insertBefore($(an_id).parent())
}
+function removePlotImages() {
+ $('img[alt="Covid Deaths"]').remove();
+ $('img[alt="Covid Cases"]').remove();
+}
+
function readFile(filename) {
try {
return fs.readFileSync(filename, 'utf8');
diff --git a/web/covid_cases.png b/web/covid_cases.png
new file mode 100644
index 0000000..f0a699a
Binary files /dev/null and b/web/covid_cases.png differ
diff --git a/web/covid_deaths.png b/web/covid_deaths.png
new file mode 100644
index 0000000..9ddcf16
Binary files /dev/null and b/web/covid_deaths.png differ