This page is a helper for homeworks at R Presentation. You will find usefull information below to solve homeworks in Python.

Data Files as CSV

NOTE: You would need to download and read the CSV files above to solve some questions.


In [3]:
# Fix for HW #2 Q2.
import numpy as np
z = np.genfromtxt('volcano.csv', delimiter=',', skip_header=True)
np.random.seed(1)
indices = np.random.randint(1, len(z.ravel()), 6) # indices to set NA
z.ravel()[indices] = np.nan # set to NaN in purpose