layout | title | permalink |
---|---|---|
page |
Tips and Resources |
tips/ |
Python is a wonderfully interactive programming language, and the Jupyter Notebook interface makes it especially easy to run and iterate on small pieces of Python code.
If you're not sure whether a particular line of code will work, try it. Run the code block and see what happens. If it doesn't work, then move on to the next tip.
Errors are your friends. When Python throws you an error, it's not just telling you that your code didn't work. Usually, the error message will also tell you why your code didn't work. This gives you important hints on how to fix your code. If you ask me questions about why your code won't run, the first thing I will do is ask you what you learned from the error message.
If you are having trouble interpreting your error message, the easiest and most effective thing to do is to copy it and paste it into Google. Quite frequently, the first or second hit will be a forum thread solving exactly your issue.
Especially later in the course, you'll know multiple ways to solve problems. When you see a solution, pause. Are there other possibilities? What are the strengths and weaknesses of your current approach? What are the strengths and weaknesses of the alternatives? What set of tradeoffs is right for the problem at hand?
The website Real Python has an excellent introduction to the Jupyter Notebook environment. You can ignore the installation instructions, since we installed our Jupyter Notebook through Anaconda. You don't need to use the command line utility nbconvert
to change your notebook into a PDF: see the expectations for submitted assignments for the recommended way.
Make sure that you're clear on how to create and run both code and Markdown cells.
These cheatsheets are assembled by DataCamp, a company that produces online tutorials in topics related to data science. DataCamp has institutionally defended their CEO against credible accusations of sexual harassment and assault toward an employee. Their unjust institutional actions coexist with the fact that they make excellent free cheat sheets. In my opinion, they are the best available on several topics. I do not otherwise support DataCamp and do not suggest that you use any of their paid resources.
- Numpy: numerical arrays.
- Matplotlib: 2d data visualization.
- Pandas: tabular data.
- Scikit-Learn: machine learning.
- Python Cheatsheet. Not so much a "cheatsheet" as a very rapid review of many fundamental concepts, including a convenient table of contents.
- A Whirlwind Tour of Python by Jake VanderPlas. A sequence of online notebooks covering Python basics, with an eye towards data science. Inspiration for several lectures in the first part of the course.