diff --git a/README.md b/README.md index cba427e..481d20f 100644 --- a/README.md +++ b/README.md @@ -3257,12 +3257,12 @@ c 6 7 +------------------------+---------------+------------+------------+--------------------------+ | | '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. | +| l.merge(r, on='y', | x y z | x y z | x y z | Merges on column if 'on' | +| how=…) | 0 1 2 . | 3 4 5 | 1 2 . | or 'left/right_on' are | +| | 1 3 4 5 | | 3 4 5 | set, else on shared cols.| | | 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.| +| l.join(r, lsuffix='l', | x yl yr z | | x yl yr z | 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 | If r is a Series, it is | | | c . . 6 7 | | | treated as a column. | @@ -3270,8 +3270,8 @@ 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 | | A Series is treated as a | -| | b . 4 5 | 4 | | column. Use l.append(sr) | -| | c . 6 7 | 6 | | to add a row instead. | +| | b . 4 5 | 4 | | column. To add a row use | +| | c . 6 7 | 6 | | pd.concat([l, DF([sr])]).| +------------------------+---------------+------------+------------+--------------------------+ | pd.concat([l, r], | x y y z | | | Adds columns at the | | axis=1, | a 1 2 . . | x y y z | | right end. Uses 'outer' | diff --git a/index.html b/index.html index 5298734..9718977 100644 --- a/index.html +++ b/index.html @@ -2654,12 +2654,12 @@ c 6 7
┏━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ │ '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. ┃
+┃ l.merge(r, on='y', │ x y z │ x y z │ x y z │ Merges on column if 'on' ┃
+┃ how=…) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ or 'left/right_on' are ┃
+┃ │ 1 3 4 5 │ │ 3 4 5 │ set, else on shared cols.┃
┃ │ 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.┃
+┃ l.join(r, lsuffix='l', │ x yl yr z │ │ x yl yr z │ 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 │ If r is a Series, it is ┃
┃ │ c . . 6 7 │ │ │ treated as a column. ┃
@@ -2667,8 +2667,8 @@ 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 │ │ A Series is treated as a ┃
-┃ │ b . 4 5 │ 4 │ │ column. Use l.append(sr) ┃
-┃ │ c . 6 7 │ 6 │ │ to add a row instead. ┃
+┃ │ b . 4 5 │ 4 │ │ column. To add a row use ┃
+┃ │ c . 6 7 │ 6 │ │ pd.concat([l, DF([sr])]).┃
┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
┃ pd.concat([l, r], │ x y y z │ │ │ Adds columns at the ┃
┃ axis=1, │ a 1 2 . . │ x y y z │ │ right end. Uses 'outer' ┃
@@ -2725,7 +2725,7 @@ plt.show() # Disp
<DF> = pd.read_clipboard() # Reads a copied table from the clipboard.
<dict> = <DF>.to_dict(['d/l/s/…']) # Returns columns as dicts, lists or series.
-<str> = <DF>.to_json/html/csv([<path>]) # Also <DF>.to_markdown/latex([<path>]).
+<str> = <DF>.to_json/html/csv([<path>]) # Also to_markdown/latex([<path>]).
<DF>.to_pickle/excel(<path>) # Run `$ pip3 install openpyxl` for xlsx files.
<DF>.to_sql('<table_name>', <connection>) # Accepts SQLite3 or SQLAlchemy connection.
diff --git a/parse.js b/parse.js
index 51e21ce..9dfc007 100755
--- a/parse.js
+++ b/parse.js
@@ -511,12 +511,12 @@ const DIAGRAM_15_B =
"┏━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ │ 'outer' │ 'inner' │ 'left' │ Description ┃\n" +
"┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨\n" +
- "┃ l.merge(r, on='y', │ x y z │ x y z │ x y z │ Joins/merges on column. ┃\n" +
- "┃ how=…) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ Also accepts left_on and ┃\n" +
- "┃ │ 1 3 4 5 │ │ 3 4 5 │ right_on parameters. ┃\n" +
+ "┃ l.merge(r, on='y', │ x y z │ x y z │ x y z │ Merges on column if 'on' ┃\n" +
+ "┃ how=…) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ or 'left/right_on' are ┃\n" +
+ "┃ │ 1 3 4 5 │ │ 3 4 5 │ set, else on shared cols.┃\n" +
"┃ │ 2 . 6 7 │ │ │ Uses 'inner' by default. ┃\n" +
"┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨\n" +
- "┃ l.join(r, lsuffix='l', │ x yl yr z │ │ x yl yr z │ Joins/merges on row keys.┃\n" +
+ "┃ l.join(r, lsuffix='l', │ x yl yr z │ │ x yl yr z │ Merges on row keys. ┃\n" +
"┃ rsuffix='r', │ a 1 2 . . │ x yl yr z │ 1 2 . . │ Uses 'left' by default. ┃\n" +
"┃ how=…) │ b 3 4 4 5 │ 3 4 4 5 │ 3 4 4 5 │ If r is a Series, it is ┃\n" +
"┃ │ c . . 6 7 │ │ │ treated as a column. ┃\n" +
@@ -524,8 +524,8 @@ const DIAGRAM_15_B =
"┃ pd.concat([l, r], │ x y z │ y │ │ Adds rows at the bottom. ┃\n" +
"┃ axis=0, │ a 1 2 . │ 2 │ │ Uses 'outer' by default. ┃\n" +
"┃ join=…) │ b 3 4 . │ 4 │ │ A Series is treated as a ┃\n" +
- "┃ │ b . 4 5 │ 4 │ │ column. Use l.append(sr) ┃\n" +
- "┃ │ c . 6 7 │ 6 │ │ to add a row instead. ┃\n" +
+ "┃ │ b . 4 5 │ 4 │ │ column. To add a row use ┃\n" +
+ "┃ │ c . 6 7 │ 6 │ │ pd.concat([l, DF([sr])]).┃\n" +
"┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨\n" +
"┃ pd.concat([l, r], │ x y y z │ │ │ Adds columns at the ┃\n" +
"┃ axis=1, │ a 1 2 . . │ x y y z │ │ right end. Uses 'outer' ┃\n" +
@@ -798,6 +798,9 @@ function fixPandasDiagram() {
$(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(and)").after("and");
$(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(as)").after("as");
$(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(is)").after("is");
+ $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(if)").after("if");
+ $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(or)").after("or");
+ $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(else)").after("else");
$(`code:contains(${diagram_15})`).find(".hljs-keyword").remove();
}