Jupyter Data Science Notebook#

Elements of Data Science#

A Jupyter notebook contains executable computer code. We use Python as the computer programming language. Notebooks are saved on the cloud server for editing and reuse. The code executes upon hitting “shift” + “enter/return” after editing a cell. The code is executed on a cluster in the cloud.

Jupyter Notebook Properties#

A Jupyter Noteboook is divided in cells which combine formatted text in markdoown cells and executable computer code in code cells. Upon executing a cell [“shift” + “enter/return”] output is displayed which contains the formatted text and/or images from markdown cells and the results/output of code execution from code cells.

# Our first code "#" makes the line a comment, good to place many comments
print("Hello Temple")
Hello Temple
# Same as above using a string variable
text = "Hello Temple" # Store quoted string in variable with label "text"
print(text)
Hello Temple
# Manipulations
a = 2021
b = 1
year = a +  b
year
2022
print(year) # Value of "year" variable is stored for later use. 
# "print" is an example of a function which takes an argument of, in this case, "year"
print("year") # This print the string 'year'
2022
year
# Simple computations without variables
3*4
12
3 ** 4 # '**' is the power operator
81
a ** (b+1) # Using earlier defined variables
4084441

Variables#

Variables store information for later processing within computer code. We can use convenient names for our variables but no spaces! The = symbol is the assignment operator which assigns the value on the right to that on the left of the =.

year = 2023
print(year, year-10)
2023 2013

We can use a combined assignment and addition operators to add to (increment) the variable year.

year += 10
print(year)
2033

Much more to come… See: https://inferentialthinking.com/chapters/03/1/Expressions.html