Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jupyterlite libraries #2

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly requests nbformat spacy\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly nbformat requests nltk\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"word = 'testing'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly nbformat requests spacy\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"import requests\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly textstat nbformat requests bs4\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"import textstat\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly nbformat requests nltk\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"text_link = 'http://www.gutenberg.org/files/1533/1533-0.txt'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http nbformat\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly nbformat requests shutil wordcloud\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"text_url = 'http://www.gutenberg.org/files/1661/1661-0.txt'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"import pandas as pd\n",
"dfi = pd.read_csv('https://raw.githubusercontent.com/callysto/data-files/main/Health/AsthmaRates/asthma-alberta-2004-2019.csv')\n",
"dfi.describe()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cells":[{"cell_type":"markdown","metadata":{},"source":["![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true)\n","\n","\n","<a href=\"https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Health/CALM/CALM-moving-out-1.ipynb&depth=1\" target=\"_parent\"><img src=\"https://raw.githubusercontent.com/callysto/curriculum-notebooks/master/open-in-callysto-button.svg?sanitize=true\" width=\"123\" height=\"24\" alt=\"Open in Callysto\"/></a>"]},{"cell_type":"markdown","metadata":{},"source":["# CALM - Moving Out Project\n","\n","📘 Imagine that you are in your early twenties, and it is time to move out of your family home. You work 40 hours per week and your wage is $15.00 per hour (gross income, meaning before deductions).\n","\n","You will be required to calculate your net income and manage financial resources effectively.\n","\n","You may choose to live with a roommate. If you choose to live with a roommate and share rent, you must each complete and hand in a separate assignment.\n","\n","You will use the internet for all the information required to complete this project. However, you may want to also refer to flyers to find prices for food and household items.\n","\n","### Technology\n","This project uses Jupyter notebooks, which are documents that contain formatted text and computer code (Python code in this case). This will allow you to do calculations much easier, and without a calculator.\n","\n","The text and code blocks are called \"cells\", this is a *Markdown* (text) cell.\n","\n","Cells that contain a pencil emoji (✏️) are ones you should edit. Cells with a book emoji (e.g. 📘) are for you to read (or `Run`) without editing."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘This is a code cell.\n","# Run the code by selecting this cell then clicking on the ►Run button in the toolbar at the top.\n","\n","2 + 3"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘This is another code cell for you to run.\n","# Every line that starts with a # character is ignored when the computer runs the code\n","\n","firstNumber = 2\n","secondNumber = 3\n","product = firstNumber * secondNumber\n","print(product)"]},{"cell_type":"markdown","metadata":{},"source":["📘 That's the basics of a Jupyter notebook, if you want to learn more and Jupyter [click here](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html).\n","\n","For now, though, let's get on with your CALM assignment."]},{"cell_type":"markdown","metadata":{},"source":["📘 Run the cell below to import libraries required for the notebook. \n","\n","Python libraries for data science are like ready-made tools in a toolbox. They contain pre-written code that make it possible to perform tasks easier."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["%pip install -r requirements.txt\n","import pyodide_http\n","pyodide_http.patch_all()\n","\n","import numpy as np\n","from functions import *\n","\n","print(\"Libraries imported.\")"]},{"cell_type":"markdown","metadata":{},"source":["## Part 1 - Personal Profile\n","\n","📘 Complete these questions based on what your hope of plan to do with your life. Once you have answered all the questions in the code cell below, run the cell using the `Run` button on the tool bar, and it will store your answers in a text file."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["Name = create_widget('Text','Your Name:','Enter your name',0,0,0)\n","Moveout = create_widget('IntSlider','I will move out at the age of:',16,0,30,1)\n","Education_path = create_widget('Text','My Education Path:','Enter what you want to study',0,0,0)\n","Occupation = create_widget('Text','My Occupation:','Enter what you want to do for work',0,0,0)\n","Salary = create_widget('IntRangeSlider','My estimated monthly Salary:',[2000,5000],0,20000,1000)\n","Married = create_widget('Checkbox','I want to marry in my twenties',False,0,0,0)\n","Children = create_widget('IntSlider','# of children I want by the age of 30:',0,0,10,1)\n","House = create_widget('Checkbox','I want to buy a house in my twenties',False,0,0,0)\n","Location = create_widget('Text','I will be living near/in:','Enter the city/town you want to live in',0,0,0)\n","Vehicle = create_widget('Text','Vehicle I want to drive:','Enter the vehicle you want to own',0,0,0)\n","Possessions = create_widget('TextArea','Things I will also own','My Possessions',0,0,0)\n","Travel = create_widget('Checkbox','I want to travel in my twenties',False,0,0,0)\n","Destinations = create_widget('TextArea','Places I want to travel to','Travel Destinations',0,0,0)\n","Bucket_list = create_widget('TextArea','Things I want to do in my twenties','Bucket list',0,0,0)\n","\n","box = widgets.VBox([Name,Moveout,Education_path,Occupation,Salary,Married,Children,House,Location,Vehicle,Possessions,Travel,Destinations,Bucket_list])\n","\n","display(box)"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["to_change = {5:'',7:'',11:''}\n","\n","def rewrite_answers(w):\n","\n"," for x in to_change:\n"," to_change[x] = \"do not\" if w[x].value == False else \"do\"\n"," \n","widget = box.children\n","rewrite_answers(widget)\n","desired_salary = np.asarray(widget[4].value)\n","%store desired_salary\n","with open('moving_out_1.txt', 'a') as f: \n"," f.truncate(0)\n"," f.write(\n"," f\"My name is {widget[0].value} and I expect to move out at the age of {widget[1].value}. \\nI want to study {widget[2].value} and have my job/occupation to be {widget[3].value}. My expected salary for this job would be in the following range: {widget[4].value} \\nIn my 20's I {to_change[5]} want to be married and I {to_change[7]} want to own a house. By the age of 30 I want to have {widget[6].value} children. \\nI want to live near {widget[8].value} and drive a {widget[9].value}. \\n\\nOther things I want to own is: \\n{widget[10].value}\\n\\nI {to_change[11]} want to travel in my 20's and these are some of the places I would like to go: \\n{widget[12].value} \\n\\nFinally, here are some of the things that I have on my bucket list: \\n{widget[13].value} \"\n"," )"]},{"cell_type":"markdown","metadata":{},"source":["📘`Run` the next cell to check that your answers have been stored in a file."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘 Run this cell to check that your file contains your answers.\n","# If you get an error, make sure you have run the code cell above.\n","with open('moving_out_1.txt', 'r') as file:\n"," print(file.read())"]},{"cell_type":"markdown","metadata":{},"source":["📘You have now completed this section. Proceed to [section 2](./CALM-moving-out-2.ipynb)"]},{"cell_type":"markdown","metadata":{},"source":["[![Callysto.ca License](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-bottom.jpg?raw=true)](https://github.com/callysto/curriculum-notebooks/blob/master/LICENSE.md)"]}],"metadata":{"kernelspec":{"display_name":"Python 3","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.8"}},"nbformat":4,"nbformat_minor":2}
{"cells":[{"cell_type":"markdown","metadata":{},"source":["![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true)\n","\n","\n","<a href=\"https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Health/CALM/CALM-moving-out-1.ipynb&depth=1\" target=\"_parent\"><img src=\"https://raw.githubusercontent.com/callysto/curriculum-notebooks/master/open-in-callysto-button.svg?sanitize=true\" width=\"123\" height=\"24\" alt=\"Open in Callysto\"/></a>"]},{"cell_type":"markdown","metadata":{},"source":["# CALM - Moving Out Project\n","\n","📘 Imagine that you are in your early twenties, and it is time to move out of your family home. You work 40 hours per week and your wage is $15.00 per hour (gross income, meaning before deductions).\n","\n","You will be required to calculate your net income and manage financial resources effectively.\n","\n","You may choose to live with a roommate. If you choose to live with a roommate and share rent, you must each complete and hand in a separate assignment.\n","\n","You will use the internet for all the information required to complete this project. However, you may want to also refer to flyers to find prices for food and household items.\n","\n","### Technology\n","This project uses Jupyter notebooks, which are documents that contain formatted text and computer code (Python code in this case). This will allow you to do calculations much easier, and without a calculator.\n","\n","The text and code blocks are called \"cells\", this is a *Markdown* (text) cell.\n","\n","Cells that contain a pencil emoji (✏️) are ones you should edit. Cells with a book emoji (e.g. 📘) are for you to read (or `Run`) without editing."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘This is a code cell.\n","# Run the code by selecting this cell then clicking on the ►Run button in the toolbar at the top.\n","\n","2 + 3"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘This is another code cell for you to run.\n","# Every line that starts with a # character is ignored when the computer runs the code\n","\n","firstNumber = 2\n","secondNumber = 3\n","product = firstNumber * secondNumber\n","print(product)"]},{"cell_type":"markdown","metadata":{},"source":["📘 That's the basics of a Jupyter notebook, if you want to learn more and Jupyter [click here](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html).\n","\n","For now, though, let's get on with your CALM assignment."]},{"cell_type":"markdown","metadata":{},"source":["📘 Run the cell below to import libraries required for the notebook. \n","\n","Python libraries for data science are like ready-made tools in a toolbox. They contain pre-written code that make it possible to perform tasks easier."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["%pip install -q pyodide_http plotly ipywidgets nbformat ipydatagrid bs4 requests\n","import pyodide_http\n","pyodide_http.patch_all()\n","\n","import numpy as np\n","from functions import *\n","\n","print(\"Libraries imported.\")"]},{"cell_type":"markdown","metadata":{},"source":["## Part 1 - Personal Profile\n","\n","📘 Complete these questions based on what your hope of plan to do with your life. Once you have answered all the questions in the code cell below, run the cell using the `Run` button on the tool bar, and it will store your answers in a text file."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["Name = create_widget('Text','Your Name:','Enter your name',0,0,0)\n","Moveout = create_widget('IntSlider','I will move out at the age of:',16,0,30,1)\n","Education_path = create_widget('Text','My Education Path:','Enter what you want to study',0,0,0)\n","Occupation = create_widget('Text','My Occupation:','Enter what you want to do for work',0,0,0)\n","Salary = create_widget('IntRangeSlider','My estimated monthly Salary:',[2000,5000],0,20000,1000)\n","Married = create_widget('Checkbox','I want to marry in my twenties',False,0,0,0)\n","Children = create_widget('IntSlider','# of children I want by the age of 30:',0,0,10,1)\n","House = create_widget('Checkbox','I want to buy a house in my twenties',False,0,0,0)\n","Location = create_widget('Text','I will be living near/in:','Enter the city/town you want to live in',0,0,0)\n","Vehicle = create_widget('Text','Vehicle I want to drive:','Enter the vehicle you want to own',0,0,0)\n","Possessions = create_widget('TextArea','Things I will also own','My Possessions',0,0,0)\n","Travel = create_widget('Checkbox','I want to travel in my twenties',False,0,0,0)\n","Destinations = create_widget('TextArea','Places I want to travel to','Travel Destinations',0,0,0)\n","Bucket_list = create_widget('TextArea','Things I want to do in my twenties','Bucket list',0,0,0)\n","\n","box = widgets.VBox([Name,Moveout,Education_path,Occupation,Salary,Married,Children,House,Location,Vehicle,Possessions,Travel,Destinations,Bucket_list])\n","\n","display(box)"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["to_change = {5:'',7:'',11:''}\n","\n","def rewrite_answers(w):\n","\n"," for x in to_change:\n"," to_change[x] = \"do not\" if w[x].value == False else \"do\"\n"," \n","widget = box.children\n","rewrite_answers(widget)\n","desired_salary = np.asarray(widget[4].value)\n","%store desired_salary\n","with open('moving_out_1.txt', 'a') as f: \n"," f.truncate(0)\n"," f.write(\n"," f\"My name is {widget[0].value} and I expect to move out at the age of {widget[1].value}. \\nI want to study {widget[2].value} and have my job/occupation to be {widget[3].value}. My expected salary for this job would be in the following range: {widget[4].value} \\nIn my 20's I {to_change[5]} want to be married and I {to_change[7]} want to own a house. By the age of 30 I want to have {widget[6].value} children. \\nI want to live near {widget[8].value} and drive a {widget[9].value}. \\n\\nOther things I want to own is: \\n{widget[10].value}\\n\\nI {to_change[11]} want to travel in my 20's and these are some of the places I would like to go: \\n{widget[12].value} \\n\\nFinally, here are some of the things that I have on my bucket list: \\n{widget[13].value} \"\n"," )"]},{"cell_type":"markdown","metadata":{},"source":["📘`Run` the next cell to check that your answers have been stored in a file."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["#📘 Run this cell to check that your file contains your answers.\n","# If you get an error, make sure you have run the code cell above.\n","with open('moving_out_1.txt', 'r') as file:\n"," print(file.read())"]},{"cell_type":"markdown","metadata":{},"source":["📘You have now completed this section. Proceed to [section 2](./CALM-moving-out-2.ipynb)"]},{"cell_type":"markdown","metadata":{},"source":["[![Callysto.ca License](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-bottom.jpg?raw=true)](https://github.com/callysto/curriculum-notebooks/blob/master/LICENSE.md)"]}],"metadata":{"kernelspec":{"display_name":"Python 3","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.8"}},"nbformat":4,"nbformat_minor":2}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
"metadata": {},
"outputs": [],
"source": [
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"%store -r\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"metadata": {},
"outputs": [],
"source": [
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"from functions import *\n",
"import plotly.express as px\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -r requirements.txt\n",
"%pip install -q pyodide_http plotly nbformat gtts\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat ipywidgets\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"#table for personal pronouns using Plotly\n",
"french = ['je','tu','elle, il, on','nous','vous','elles, ils']\n",
"english = ['I','you','she, he, one','we','you (plural or formal)','they']\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat ipywidgets nltk\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"import pandas as pd\n",
"fry = pd.read_csv('https://raw.githubusercontent.com/callysto/data-files/main/Languages/MostUsedEnglishWords/fry-sight-words.csv')\n",
"ngrams = pd.read_table('https://raw.githubusercontent.com/callysto/data-files/main/Languages/MostUsedEnglishWords/frequency-alpha-gcide.txt', delim_whitespace=True)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat googletrans gtts\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"translate_this = 'Hello, how are you today?'\n",
"source = 'en'\n",
"destination = 'fr'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat ipywidgets\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"from IPython.display import IFrame\n",
"IFrame(src='https://www.desmos.com/calculator/nh9wc0y8s9', width=800, height=500)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q pyodide_http plotly nbformat\n",
"import pyodide_http\n",
"pyodide_http.patch_all()\n",
"\n",
"walking_times = [10, 15, 12, 20, 8]\n",
"minimum = min(walking_times)\n",
"maximum = max(walking_times)\n",
Expand Down
Loading
Loading