pandas exercises.ipynb
) and the Module 2 notes from the textbook into your class notes repo, open bothnumpy
pandas
Please fill out a short check in survey soon: Link here, or on the dashboard's tasks
The award for most commits goes too...
Come on down!
And also, an award for favorite README meme (TOUGH competition)
⭐⭐⭐ MOST IMPORTANT: You must clone the repo to your computer and run the code ON YOUR COMPUTER (The essential ingredient of collaborative coding, and a fundamental takeaway from class) ⭐⭐⭐
If you have questions while doing reviews
Volunteer? I'll submit a full feedback form for your assignment as well.
To use numpy functions, add this to beginning of your notebook: import numpy as np
Why is there a chapter in the book on it?
Numpy is great for:
np.median()
, np.percentile()
, np.floor()
np.nan
(missing value)np
🤝 pandas
numpy.org/doc has pages with
import numpy as np
myray = np.arange(15) # create array
print("myray:", myray)
print("slice:", myray[6:11]) # pick the 6-10th elements
# Q1: pick the odd elements
myray: [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] slice: [ 6 7 8 9 10]
# create a random vector (every run of this --> diff #s)
from numpy.random import default_rng
rg = default_rng()
myray = rg.standard_normal(5)
print("myray:", myray)
# Q2: how can you always select the positive elements from this?
# prof demo: booleans, a single condition-->bool,
# using booleans on an array/list,
# indexing/filtering via booleans as "masks"
# then answer
myray: [ 1.33145787 0.54058088 -0.06731178 -0.88356257 -0.09785319]
Let's learn to use pandas by working with real data!
FRED is https://fred.stlouisfed.org/
Now, let's go back to the exercise file and stop right before EDA.
Can we make it fun?
No.
OK But can we eliminate frustration?
Also no.
However, we can make it WORK. (Also, it's weirdly satisfying once you get into it.)
Let's try Q0-Q3.
Will resume the pandas
exercises next class, ⭐⭐ during which we will have our first student led demos. ⭐⭐
Also, the link to ASGN2 is on coursesite.
Demos - walk us through your attempts!
Post script, I'll build on this to show:
( # anything between these parens
# is "one" line of code
)
The point here isn't that this all makes perfect sense.
Follow my process.
You can look into the specific code bits later.
Pandas = \$ : No ML without EDA, no EDA without pandas
Bosses:
import seaborn as sns
to make the plot, look up hue
option