Intro to python and Jupyter#3
Conversation
…er lab navigation
Removed objectives out of scope.
Thank you!Thank you for your pull request 😃 🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}. If you have files that automatically render output (e.g. R Markdown), then you should check for the following:
Rendered Changes🔍 Inspect the changes: https://github.com/carpentries-incubator/python-ecology-lesson/compare/md-outputs..md-outputs-PR-3 The following changes were observed in the rendered markdown documents: What does this mean?If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible. This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation. ⏱️ Updated at 2025-10-27 16:07:35 +0000 |
josenino95
left a comment
There was a problem hiding this comment.
Hi! This all looks great and I feel is a great intro for the workshop and the use of the JupyterLab IDE. Thanks! Only a few comments to think about or discuss with the group.
|
|
||
| When you send commands to Python, you get a response back. Sometimes, when you make mistakes, you will get back a nice, informative error message or warning. However, sometimes the warnings seem to reference a much "deeper" level of Python than you're familiar with. Or, even worse, you may get the wrong answer with no warning because the command you sent is perfectly valid, but isn't what you actually want. While you may first have some success working with Python by memorizing certain commands or reusing other scripts, this is akin to using a collection of tourist phrases or pre-written statements when having a conversation. You might make a mistake (like getting directions to the library when you need a bathroom), and you are going to be limited in your flexibility (like furiously paging through a tourist guide looking for the term for "thrift store"). | ||
|
|
||
| This is all to say that we are going to spend a bit of time digging into some of the more fundamental aspects of the Python language, and these concepts may not feel as immediately useful as, say, learning to make plots with `matplotlib`. However, learning these more fundamental concepts will help you develop an understanding of how Python thinks about data and code, how to interpret error messages, and how to flexibly expand your skills to new situations. |
There was a problem hiding this comment.
I'm not sure if this statement hold as the first Python code we learn is for plotting.
|
|
||
| #### Jupyter Notebooks | ||
|
|
||
| - A Jupyter Notebook is a living code document which combines code and markdown into the same document. This is similar to R Markdown files for R. |
There was a problem hiding this comment.
| - A Jupyter Notebook is a living code document which combines code and markdown into the same document. This is similar to R Markdown files for R. | |
| - A Jupyter Notebook is a living code document which combines code and markdown into the same document. If you've coded in R before, this is similar to R Markdown and Quarto files. |
Here is a suggestion adding Quarto files, and with a different phrasing
tobyhodges
left a comment
There was a problem hiding this comment.
This is great, thanks so much @glstott. I have requested a few changes and suggested a few others but I think this is nearly ready to merge.
| exercises: 5 | ||
| --- | ||
|
|
||
| ::::::::::::::::::::::::::::::::::::::: Questions |
There was a problem hiding this comment.
| ::::::::::::::::::::::::::::::::::::::: Questions | |
| ::::::::::::::::::::::::::::::::::::::: questions |
Lowercase should be used for fenced div class keywords.
|
|
||
| ::::::::::::::::::::::::::::::::::::::: | ||
|
|
||
| ::::::::::::::::::::::::::::::::::::::: Objectives |
There was a problem hiding this comment.
| ::::::::::::::::::::::::::::::::::::::: Objectives | |
| ::::::::::::::::::::::::::::::::::::::: objectives |
|
|
||
| [Jupyter Lab](https://jupyter.org/) is a web-based interactive computing environment compatible across multiple programming languages. This tool allows you to work with documents like Jupyter notebooks, text editors, terminals, and custom components in a flexible way. | ||
|
|
||
| In a Jupyter notebook, code, markdown, and raw text are included in a single document broken into cells. Each cell has its own type: raw text, markdown, or code. Raw text cells output raw text, markdown cells are translated into formatted text using a markdown interpreter, and the code cells run the code through the kernel you select in Jupyter Lab (in our case, Python!). These files are stored as a JSON file with the ".ipynb" extension. |
There was a problem hiding this comment.
I guess a callout or spoiler may be necessary here, to explain what Markdown is.
| ## Your new pedantic collaborator... | ||
|
|
||
| You're working on a project when your advisor suggests that you begin working with one of their long-time collaborators. According to your advisor, this collaborator is very talented, but only speaks a language that you don't know. Your advisor assures you that this is ok, the collaborator won't judge you for starting to learn the language, and will happily answer your questions. However, the collaborator is also quite pedantic. While they don't mind that you don't speak their language fluently yet, they are always going to answer you quite literally. | ||
|
|
||
| You decide to reach out to the collaborator. You find that they email you back very quickly, almost immediately most of the time. Since you're just learning their language, you often make mistakes. Sometimes, they tell you that you've made a grammatical error or warn you that what you asked for doesn't make a lot of sense. Sometimes these warnings are difficult to understand, because you don't really have a grasp of the underlying grammar. Sometimes you get an answer back, with no warnings, but you realize that it doesn't make sense, because what you asked for isn't quite what you *wanted*. Since this collaborator responds almost immediately, without tiring, you can quickly reformulate your question and send it again. | ||
|
|
||
| In this way, you begin to learn the language your collaborator speaks, as well as the particular way they think about your work. Eventually, the two of you develop a good working relationship, where you understand how to ask them questions effectively, and how to work through any issues in communication that might arise. | ||
|
|
||
| This collaborator's name is Python. | ||
|
|
||
| When you send commands to Python, you get a response back. Sometimes, when you make mistakes, you will get back a nice, informative error message or warning. However, sometimes the warnings seem to reference a much "deeper" level of Python than you're familiar with. Or, even worse, you may get the wrong answer with no warning because the command you sent is perfectly valid, but isn't what you actually want. While you may first have some success working with Python by memorizing certain commands or reusing other scripts, this is akin to using a collection of tourist phrases or pre-written statements when having a conversation. You might make a mistake (like getting directions to the library when you need a bathroom), and you are going to be limited in your flexibility (like furiously paging through a tourist guide looking for the term for "thrift store"). | ||
|
|
||
| This is all to say that we are going to spend a bit of time digging into some of the more fundamental aspects of the Python language, and these concepts may not feel as immediately useful as, say, learning to make plots with `matplotlib`. However, learning these more fundamental concepts will help you develop an understanding of how Python thinks about data and code, how to interpret error messages, and how to flexibly expand your skills to new situations. |
There was a problem hiding this comment.
I like this analogy as a framing for the learning that is about to happen but I don't think it quite answers the question of the heading above, why learn Python?, beyond a vague mention that "the collaborator is very talented."
I think an additional sentence, mentioning e.g. the versatility of the language and its potential to give you access to techniques and a scale of data analysis that was previously unavailable, would help.
| #### Jupyter Notebooks | ||
|
|
||
| - A Jupyter Notebook is a living code document which combines code and markdown into the same document. This is similar to R Markdown files for R. | ||
| - You can make a new Jupyter Notebook by clicking `File → New → Notebook` or clicking the `Python` option in the **Launcher** tab under the `Notebook` header. |
There was a problem hiding this comment.
I would like a sentence here that stresses the importance of renaming the notebook, also. Writing as somebody who has created and encountered hundreds of Untitled.ipynb files over the years...
Draft of "Introduction to Python and Jupyter Lab" episode.