-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #311 from kayjan/feature/mkdoc-jupyter
Add jupyter notebook for mkdocs
- Loading branch information
Showing
4 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# 📋 Workflow Demonstration\n", | ||
"\n", | ||
"There are existing implementations of workflows to showcase how `bigtree` can be used!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "plaintext" | ||
} | ||
}, | ||
"source": [ | ||
"## To Do Application\n", | ||
"There are functions to:\n", | ||
"\n", | ||
"- Add or remove list to To-Do application\n", | ||
"- Add or remove item to list, default list is the 'General' list\n", | ||
"- Prioritize a list/item by reordering them as first list/item\n", | ||
"- Save and import To-Do application to and from an external JSON file\n", | ||
"- Show To-Do application, which prints tree to console\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"To Do App\n", | ||
"├── School\n", | ||
"│ └── Homework 1\n", | ||
"├── Groceries\n", | ||
"│ ├── Milk [description=Urgent]\n", | ||
"│ └── Bread [description=Urgent]\n", | ||
"└── General\n", | ||
" └── Cook\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from bigtree import AppToDo\n", | ||
"\n", | ||
"app = AppToDo(\"To Do App\")\n", | ||
"app.add_item(item_name=\"Homework 1\", list_name=\"School\")\n", | ||
"app.add_item(item_name=[\"Milk\", \"Bread\"], list_name=\"Groceries\", description=\"Urgent\")\n", | ||
"app.add_item(item_name=\"Cook\")\n", | ||
"app.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"app.save(\"list.json\")\n", | ||
"app2 = AppToDo.load(\"list.json\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Calendar Application\n", | ||
"\n", | ||
"There are functions to:\n", | ||
"\n", | ||
"- Add or remove event from Calendar\n", | ||
"- Find event by name, or name and date\n", | ||
"- Display calendar, which prints events to console\n", | ||
"- Export calendar to pandas DataFrame" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"My Calendar\n", | ||
"2023-01-01 00:00:00 - Dinner (budget: 20)\n", | ||
"2023-01-01 18:00:00 - Gym\n", | ||
"2023-01-02 18:00:00 - Gym\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import datetime as dt\n", | ||
"from bigtree import Calendar\n", | ||
"\n", | ||
"calendar = Calendar(\"My Calendar\")\n", | ||
"calendar.add_event(\"Gym\", \"2023-01-01 18:00\")\n", | ||
"calendar.add_event(\"Dinner\", \"2023-01-01\", date_format=\"%Y-%m-%d\", budget=20)\n", | ||
"calendar.add_event(\"Gym\", \"2023-01-02 18:00\")\n", | ||
"calendar.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2023-01-01 18:00:00 - Gym\n", | ||
"2023-01-02 18:00:00 - Gym\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"calendar.find_event(\"Gym\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"My Calendar\n", | ||
"2023-01-01 00:00:00 - Dinner (budget: 20)\n", | ||
"2023-01-02 18:00:00 - Gym\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"calendar.delete_event(\"Gym\", dt.date(2023, 1, 1))\n", | ||
"calendar.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>path</th>\n", | ||
" <th>name</th>\n", | ||
" <th>date</th>\n", | ||
" <th>time</th>\n", | ||
" <th>budget</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>/My Calendar/2023/01/01/Dinner</td>\n", | ||
" <td>Dinner</td>\n", | ||
" <td>2023-01-01</td>\n", | ||
" <td>00:00:00</td>\n", | ||
" <td>20.0</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>/My Calendar/2023/01/02/Gym</td>\n", | ||
" <td>Gym</td>\n", | ||
" <td>2023-01-02</td>\n", | ||
" <td>18:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" path name date time budget\n", | ||
"0 /My Calendar/2023/01/01/Dinner Dinner 2023-01-01 00:00:00 20.0\n", | ||
"1 /My Calendar/2023/01/02/Gym Gym 2023-01-02 18:00:00 NaN" | ||
] | ||
}, | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"data_calendar = calendar.to_dataframe()\n", | ||
"data_calendar" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "bigtree", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.14" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters