This week contains a variety of content:
The first two weeks we acquire the tools that provide a way to run machine learning algorithms in Python. Machine learning per se occupies in Weeks 3 through 7.
Video tip: You can adjust the playback speed of the videos as you wish.
Find each week's conceptual content in my developing interactive text with embedded videos under the Canvas Modules for the current week.
READ/WATCH: Introduction to Python for Data Analysis
The videos present the same material as the posted online reading with some additional discussion. However, if you understand the reading, there is no compelling reason to watch the following videos.
Read this online text on any device with a web browser, including phones, chromebooks, and computers. Find at the top-left of the posted content an overview, an interactive menu. On the top-right of each page find an interactive menu dedicated to the current section. Change the font-size from your browser. Click on the embedded video links for demonstrations and examples of doing Python.
As you read and study this online material, do you ever encounter a section that you find difficult to understand? If so, please let me know via email or during my twice weekly office hours. Maybe I can not only answer your questions but perhaps I can then revise the online material for better clarification. Communication works both ways. I enjoy your feedback.
The following video, Introduction to Jupyter Lab [7:43] (also linked above), presents many of the basics for developing Jupyter Notebooks of Python code in the Jupyter Lab environment. If you are using RStudio to do the assignments, the code is identical. The various sections of this video, listed below, are explained in sequence in Section 2 of the above linked reading. You can begin to watch this video as you follow the description in Section 2 or you can watch now to preview how to develop Python code with Jupyter Notebooks in the Jupyter Lab environment.
Skip directly to any of the following chapters by clicking on the three horizontal bars displayed in the top-left of the video, which displays the table of contents. Click on the three horizontal bars again to remove the displayed table of contents.
0:00 Title
0:09 Login, New Notebook
1:27 Hello World
2:10 New Code Cell
2:54 Markdown Cell
3:59 Data Folder
4:56 Upload a Notebook
5:48 Read Data
7:05 Download a Notebook
Select any notebook cell, code or markdown (text), by clicking in the left-margin outside of the cell. You will see a heavy, vertical blue line, which indicates that the cell is selected and not in editing mode to change the contents of the cell. Push b to add a new cell following and a to add a new cell preceding the selected cell. By default the new cell is a code cell. Push m to change the cell to a markdown cell. Of course, icons exist to achieve these same results.
To edit a code cell, click the cell contents once. To edit a markdown cell, double-click the cell contents. To run the Python code in a code cell or to render the text in a markdown cell, click the arrowhead icon or push CNTRL/ENTER or CMD/RETURN for Windows or Macintosh, respectively. To restart and run all cells, click the double arrowhead, or, from the Kernel menu select the Restart Kernel and Run All Cells or some variation of that menu selection to run only some of the cells.
Remember:
x = 3z = x + yy has not yet been defined when it is referenced in the second equation.
--------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[2], line 1 ----> 1 z = x + y NameError: name 'y' is not defined
Often the error messages from Python are not very helpful. Other times, the message unambiguously points to the problem, as in this example where the message is that the variable 'y' is not defined. In more complex situations, there will be a list of multiple error messages. You may need to go to the beginning of list to identify the most relevant message.
As described in the syllabus, the Python content introduced each week is presented in the form of a working Python program, called a template. Find the template Python notebook for each week in pdf format plus the accompanying video for each week in the Canvas Modules section. This week's template is named Read and Display Data. Base your Python for doing the homework analysis problems on this template. Your homework needs to adapt the code to the assigned problems, with some documentation, but you do not need to provide all of the documentation that I provide, and better to document in your own words. The key is that you could accomplish the same task on the job, adopting the relevant template to an analysis for your work instead of homework.
Find the pdf of the template in the Canvas Modules for the given week. Find the links to the video explanation of the template below.
The best approach to complete each Python assignment is to create a Jupyter Notebook or RStudio code file directly from each week's template, cell by cell. Do not make any changes to the code cells of the notebook. Implement the Python code exactly as I present it. Then, once the original is working, begin to adapt the document to the current week's homework, again, cell by cell. If you try to change directly without getting what I provide to first work, then when you encounter errors you cannot easily isolate the source of the error.
Right-click to download any of these files, particularly the Python analysis notebook.
Instructions [.html]
Concepts: Short-Answer [.docx]
Python: Template [.pdf]
Python: Analysis [.ipynb]