#!/usr/bin/env python # coding: utf-8 # ## **Guess what? You're using a Jupyter Notebook right now!** # # # # ## What is this thing? # # **Jupyter combines interwoven text, data, and code, in a format that runs in a web browser.** # * 'Jupyter' = JUlia, PYthon, and R - but it's really language-agnostic # * Jupyter Notebooks let you run code immediately # * Jupyter Notebooks can connect to a server that has the right environment/dependencies to execute the code successfully. In this case, we're using a server provided by ITHAKA, parent company to JSTOR and [Constellate](https://constellate.org/), which is the platform you'll use to build your text analysis dataset. # # Any time you open a notebook, you will be working on your own temporary copy that you can edit without affecting the original or anyone else's work. So please feel free to press buttons and edit and delete things without fear. You can always close and re-open this document if you need to start over. # ## What am I looking at? # There are two main parts to a notebook: # 1. Document controls (the toolbar at the top of the page) # 2. Document content, which is made up of components called cells # # Jupyter Notebooks are collections of **cells that do different things.** # # You can **navigate** through the cells of a notebook (including this one) by using the **'run' command** in the toolbar above. # **What do the cells do?** For this exercise, we'll talk about 2 kinds of cells. # * This cell is an example of a **markdown** cell. Markdown cells just contain text, and are used for commenting code, creating headings, etc. # # * There are also executable **code cells**. You can recognize code cells by the pair of brackets and a colon in the left margin, like so ``[ ]:`` # # Let's try running a code cell to see what happens. # # ### Exercise 1: Run a code cell. # To run the code cell below, click on the cell and then press the "Run cell" button # In[ ]: 1 + 1 # When you have run the cell, you should see an output appear just below the code cell: # # # # The output after you run a cell essentially forms part of the document as you work through it. # # You may have noticed the brackets on the left change from being empty to containing a number. This tells you that the cell has successfully been run. Brackets will give you information about a code cell, like so: # * ``[ ]:`` never been run # * ``[*]:`` still running # * ``[1]:`` was run 1st of all the cells in the document # * ``[7]:`` was run 7th of all the cells in the document # # If you run this code cell a second time, you will see the brackets change to ``[2]:``. The number will always update to reflect the last time you ran the cell. In general, it's a good practice to run cells in sequential order as you work through a notebook to avoid errors. # # Running code cells is something you will do a lot of during this workshop! You can either press the run button each time, or you can use the following **keyboard shortcuts**: # * Windows: press Ctrl + Enter # * Mac: press Shift + Return # ### Exercise 2: Edit a cell. # # To practice editing a cell, double-click on the cell below. You'll see the cell highlight on the left change from **blue** to **green**, indicating that you're now editing a cell. # # Try changing one of the numbers or the operator. Then run the cell using the 'run' button or one of the keyboard shortcuts above. # In[ ]: 1 + 1 # ### Exercise 3: Restart this notebook. # To completely restart this notebook and clear all of your work, click on the "Kernel" menu and then click on the "Restart & Clear Output" option. # # Then, click "Restart and Clear All Outputs" on the pop-up window that appears. # # This will completely reset the notebook. # # Lesson Complete! # Next, we'll look at [Getting started with Python.](./SCSept21GettingStartedwithPython.ipynb) # ### More information # If you would like to learn more about Markdown, check out this quick [Markdown guide](https://www.markdownguide.org/cheat-sheet/) or this longer [Markdown tutorial](https://www.markdowntutorial.com/). # If you're curious about how we have set this notebook up, read on: # # * **[Binder](https://binder.constellate.org/)** is the *environment* we are using to access ("run") our Jupyter Notebooks inside a browser. It's kind of like a separate computer in the cloud that makes all of tools we need to use in Jupyter Notebooks work. We're using [Constellate's](https://constellate.org/) Binder for this session, but anyone can [create their own Binder](https://mybinder.org/). # # # * We use **[Github](https://github.com/jasf-/tdm-nbs)** to store the Jupyter Notebooks (.ipynb files) for this session. Like any other computer, Binder will power down after a while--basically after a certain period of inactivity. So we need a place to make our Jupyter Notebooks available, and tell Binder where to find them the next time we start up a Binder session to interact with our notebooks. #
# # Adapted by [Kate Kryder](https://library.northeastern.edu/about/library-staff-directory/kate-kryder) and [Jen Ferguson](https://library.northeastern.edu/about/library-staff-directory/jen-ferguson) from two notebooks created by [Nathan Kelber](http://nkelber.com) and Ted Lawless for [JSTOR Labs](https://labs.jstor.org/) under [Creative Commons CC BY License](https://creativecommons.org/licenses/by/4.0/).
See [here](https://docs.tdm-pilot.org/tag/beginner-lessons/) for the original versions. Some content was also adapted from notebooks created by [Sarah Connell](https://library.northeastern.edu/about/library-staff-directory/sarah-connell) and Jen Ferguson for earlier versions of this workshop.
# ___