Skip to content

Intro to python and Jupyter#3

Open
glstott wants to merge 5 commits into
mainfrom
intro-to-python
Open

Intro to python and Jupyter#3
glstott wants to merge 5 commits into
mainfrom
intro-to-python

Conversation

@glstott
Copy link
Copy Markdown

@glstott glstott commented Oct 27, 2025

Draft of "Introduction to Python and Jupyter Lab" episode.

  • I copied much of the content from the Introduction to R and R Studio lesson in the DC Ecology R lesson. Then, I modified the relevant components of the text.
  • For this lesson, mirroring the R episode was not challenging since there were few differences other than the interface and details on how things function.
  • A good chunk of the old material was removed, but as Jose suggested, it will be best to start fresh, then add back what is missing afterwards as needed.
  • Jupyter Lab interface is a bit more difficult to describe since it isn't broken out into the panels of RStudio, I'd love extra attention on that section to see if I missed important bits or if phrasing is hard to follow.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 27, 2025

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:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

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:

 fig/01-jupyterlab-launcher.png (new) | Bin 0 -> 66135 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
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

github-actions Bot pushed a commit that referenced this pull request Oct 27, 2025
Copy link
Copy Markdown

@josenino95 josenino95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this statement hold as the first Python code we learn is for plotting.

Comment thread episodes/001-introduction-python-jupyter.md

#### 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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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

Copy link
Copy Markdown
Member

@tobyhodges tobyhodges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
::::::::::::::::::::::::::::::::::::::: Questions
::::::::::::::::::::::::::::::::::::::: questions

Lowercase should be used for fenced div class keywords.


:::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::: Objectives
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
::::::::::::::::::::::::::::::::::::::: 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a callout or spoiler may be necessary here, to explain what Markdown is.

Comment on lines +40 to +52
## 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread episodes/001-introduction-python-jupyter.md
#### 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants