Homework 0
Homework 0
3. Google Colab
Google Colab is a great resource for any Machine Learning class. Follow the steps
in https://colab.research.google.com/notebooks/intro.ipynb to become more
familiar with Google Colab.
4. Pandas
This section is for practicing basic funtions of the Pandas library using the Salaries
data set.
1
Homework 0 DSCI 552, Instructor: Mohammad Reza Rajati
(f) Create a Python dictionary object whose keys are the headers of the dataframe
created in the read_csv() exercise and values are Python list objects that contain
data corresponding to the headers. (Here, use the iterrows() method to iterate
each row of the dataframe and copy it to a dictionary. However, there is an easier
way. Learn how the to_dict() method works by yourself later)
(g) Create a dataframe using pd.DataFrameRead (Documentation Link) and from
the dictionary created in (e). Then, change the header to "a", "b", "c", ... .
5. Numpy
Quick start:
https://www.numpy.org/devdocs/user/quickstart.html
(a) Create a 2-dimensional Python list object, then convert it to a Numpy array
object.
(b) Examine the ndim, shape, size, dtype, itemsize, and data attributes of the numpy
array object. Make sure you understand their functions.
(c) Learn the dimension concept of an ndarray object by using reshape() and flatten()
methods.
(d) Understand how the slice operation works for 1-D arrays and 2-D arrays and
practice by yourself.
(e) Learn operations on ndarray by examining the argmin(), argmax(), min(), max(),
mean(), sum(), std(), dot(), square(), sqrt(), abs(). exp(), sign(), and mod()
methods. Make yourself comfortable with these methods.
(f) Examine the arange(), ones(), zeros(), eye(), linspace(), and concatenate() meth-
ods. Make yourself comfortable with these methods.
6. Scikit-Learn
This section introduces some packages (or methods) in Python (Scikit-Learn and Scipy)
that will be frequently used in your programming assignments. You must become
familiar with them and use them masterfully.
2
Homework 0 DSCI 552, Instructor: Mohammad Reza Rajati
(a) In the directory of this jupyter notebook file locates, initiate a Git repository.
(b) Check out a new branch called dev and commit the current notebook within this
branch.
(c) Merge the dev branch to the master branch (the default branch).
(d) Create a temporary repository (just for practicing and you can delete it later) in
GitHub.
(e) Push new changes in the master branch to the remote repository created in step
(d).
(f) Checkout the dev branch again and do some changes to your notebook, and then
repeat step (c) and step (e).
8. Matplotlib
Quick start:https://matplotlib.org/3.1.1/tutorials/introductory/pyplot.html
3
Homework 0 DSCI 552, Instructor: Mohammad Reza Rajati
(a) Create two one dimensional arrays x and y and plot y vs x, add title, xlabel,
ylabel, grid.
(b) Create multiple arrays and plot them with different styles, add legends, add
text/mathematical equations on the plot.
(c) Create multiple subplots, play around with the figure size, text font/size.
(d) Get familiar with get current axis (gca) handle to do the above tasks
(e) Change the limits on x and y axes, use logarithmic axes to plot.
9. Seaborn
Quick start:https://seaborn.pydata.org/introduction.html