<jupyter_start><jupyter_text>![alt text](https://cdn-images-1.medium.com/letterbox/266/72/50/50/1*wOHyKy6fl3ltcBMNpCvC6Q.png?source=logoAvatar-lo_XrkzqdM0PkJD---95916e268740"Jupyter Notebook Logo")An Introduction to Jupyter NotebooksWelcome to **Jupyter Notebooks**, your introduction to coding in science class.  Learning how to code is a lot like learning a new language, the language you will begin to learn today is called _**Python**_.  Python is a language used to write phone applications, program websites, and by scientists for data analysis.  Just like in a foreign language class, you aren't expected to write in paragraphs right away.  Jupyter Notebooks is a coding tool that helps you learn to "speak" python by breaking code into small parts called **blocks**, writing one block of code is a lot like writing one sentence (if you learn to write enough sentences, you can eventually write paragraphs).The **block** you are reading right now is called a **markdown**.  The purpose of a **markdown** is to give you easy to read instructions or explanations between coding **blocks**.  Try clicking this **markdown** to highlight it.  It will get a box around the entire **block**.  Now try double-clicking on it, how does what you see change when you go _"behind the scenes"_?  (When you are done, hold the shift key and press the enter key, that's how you run your block so you can see what your code does)Part 1: Mastering MarkdownGive it a try! Click on the empty grey **markdown** block after this, in your own words, write what each of these things are: Jupyter Notebook, Python, Block, & Markdown     - How do you make the word you are defining bold and its definition italicized (in italics)?    - How do you make each definition appear on its own line?  Remember, to run your block hold shift and press enter.  Don't move on until you can answer those questions and apply your answer.  PART 2: Importing LibrariesSo to be honest, you still haven't coded.  Markdown blocks are like code but they are not (It was fun though, wasn't it?!).  Before you can start coding you need to import a **library**.  **Libraries** are sets of pre-made code that you can use without having to type a lot (less work = good!).  When you start a new coding project in Jupyter Notebooks you have to choose what libraries (or types of tools) you will need.  Fortunately, we always do this part for you!  If you don't import the **libraries** you need into your Jupyter Notebook then it won't work.  So far the only **block** type that you've used has been **markdown** but to do this you will need a **Code Block** like the one you see after this.  Unlike **markdown blocks**, **code blocks** have either In [ ] next to them.Try running (hold shift and press enter) the **code block** below (we pre-filled in some real code for you, yay!)  **_Before_** you do, think about these questions.    - Add "library" to your definition list in Part 1.        - What might this code block do?    - What happens to the In [ ] when I do this?After you run the **code block** move on to the next **markdown** regardless of what happens.<jupyter_code>Image(url= 'http://www.reactiongifs.com/r/mgc.gif')<jupyter_output><empty_output><jupyter_text>So it didn't work the first time...  It gave you a bunch of scary (and confusing) "NameError"" messages.  What did you do wrong?  Did you break it?!  No, you didn't.  You "forgot" to import the **libraries** we need.  Since the code started with the word "image" and the website ended in .gif you may have guess that the code was supposed to do something with pictures, and if you did you were right (go you!).  It might not seem like it, but a lot of complicated coding goes into that "Image(url=" part.  That one line of code does all of the following things:    1. Goes to a website    2. Finds the image linked    3. Downloads a temporary version    4. Displays the image as an output in the same format & size    5. Displays animation as necessary    Let's go ahead and give our **Jupyter Notebook** the tools it needs to do those five things with one word by running the **code block** after this to import the **library** that contains the "Image()" tool.  This **block** might look a little complicated, but the good news is we always give this one to you.Once you've run that block, go back to code that didn't work and try running it again.  (Keep watching the In [ ] and Out [ ] to see how they change.  As you do think about these questions:    - What happens to the number in the In [ ] section?  What do you think it means?    - Why does the code block work now when it wouldn't before?After you see the result, go on to part 3.<jupyter_code>import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import Image
from IPython.core.display import HTML<jupyter_output><empty_output><jupyter_text>Part 3: Navigating Jupyter NotebooksNow that you have successfully imported the libraries we need, you are ready to do some coding!  Let's start out by practicing that code that displayed an image you just used.  Look closely at the way that is written, notice what is uppercase, look at where there are spaces and where there are none.  Your first coding challenge is this.  Using Google image search, find a _picture_ of the periodic table that shows at least the symbol, name, atomic number, and atomic mass for each element (any other information is a bonus) once you find it, right click on it and choose "copy image address" (like the example) and then type the code and paste the image address into a line just like the "magical" picture.![alt text](https://docs.google.com/drawings/d/e/2PACX-1vRnebwYaB2In9cXhaeiK4r8uXTyg71N28kyqWsKLaGHRTpMxvkOFvx0FXm_SnamCqsL2Jw9JQmQBtvU/pub?w=1400&h=495 "Copy Image Address Example")<jupyter_code><jupyter_output><empty_output><jupyter_text>Part 4: Getting Data from the InternetLook at the picture of the periodic table you just by creating computer code.  Remember, the periodic table is a summary of some of the most important information, but there is MUCH more that is known then what is on the table.  You are going to use Jupyter Notebooks to analyze a spreadsheet of all the elements that includes even more information than the periodic table.In order to do this we have to import that extra information to out program.  The easiest way to do this is to use a function from one of the libraries we imported before.  Find where it says "pd" in the code.  Do you remember doing this?  ** import ** pandas ** as ** pdRemember now?When we imported a library called pandas we named it pd (because its easier to type "pd" instead of "pandas" every time we use it).  This is a library that tells our program how to read data tables. After the period it says "read_csv", that tells our program that it is reading a special file called a .csv (which is a type of spreadsheet excel can make).  After that it has the website we are getting the spreadsheet from.You might be saying, "What about the first part, where it says "LASERCATS =" that part looks pretty cool", what we've done there is told our program that we would like to name the csv file "LASERCATS" once it is imported.  We could have named the data absolutely anything, we chose LASERCATS because its awesome.  If you want you could change the name to anything you want (as long as it's school appropriate).  If you do, just realize that you need to change it to that new name from now on.<jupyter_code>LASERCATS = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/c2dd862cd38f21b0ad36b8f96b4bf1ee/raw/1d92663004489a5b6926e944c1b3d9ec5c40900e/Periodic%2520Table%2520of%2520Elements.csv")<jupyter_output><empty_output><jupyter_text>It might not look like anything just happened but lets use another piece of code to look at the data table.<jupyter_code>LASERCATS.head(3)
# shows you what data you can graph the names of all the columns in the dataset
LASERCATS.columns<jupyter_output><empty_output><jupyter_text>PART 3: Unstructured Coding<jupyter_code>LASERCATS.Radioactive.count()
# Set variables for scatter plot
x = LASERCATS.Group
y = LASERCATS.NumberofValence

plt.scatter(x,y)
plt.title('Looking For Patterns')
plt.xlabel('x-axis')
plt.ylabel('y-axis')

#this sets the interval on the x-axis
plt.xticks(np.arange(min(x), max(x)+1, 1.0))

# This actually shows the plot
plt.show()
LASERCATS[['AtomicNumber', 'Element', 'Type']].sort_values(by='AtomicNumber')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06726246472248354, 'fraction_numerical': 0.013993414863593604, 'mean_word_length': 4.529908972691808, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '36381', 'license': 'MIT', 'n_tokens_mistral': 2477, 'n_tokens_neox': 2337, 'n_words': 1274, 'path': 'BETA_Intro_Comp1.ipynb', 'repo_name': 'SCPSscience/Comp1', 'size': '8504'}