Are you stuck on something?
We all get stuck sometimes. Here is the sequence of steps you might follow, although the exact things you do obviously will depend on the task:
- Help functions and Python documentation
- Search Google/Stack Overflow. Stack Overflow in particular is where the programming community asks and answers questions.
- Ask your peers - either in person or by posting an issue in the class discussion repo page - and other programmers on Stack Overflow.
- The TA’s office hours
- My office hours or email. I’ve listed myself last because, although I’m happy to help (I am!), I can’t actually debug for 60+ students.
Asking questions (steps 3-5 above) is an important part of this class! I’m borrowing the 15 minute rule:
Once you’ve spent 15 minutes attempting to troubleshoot a problem, you must ask for help!
How to properly ask for help
This section applies to Stack Overflow, our discussion repo, and if you follow this, office hours will be more efficient too. Coders expect other programmers will try the obvious (documentation, and previous Stack Overflow threads) and then follow these tips so the community can answer effectively and efficiently.
Making your question effective is an art. To make your question effective, the idea is to make things as easy as possible for someone to answer.
- Will they have to dig to find a resource you’re talking about, or do you provide links?
- If your code isn’t doing what you expect, or you don’t know how to obtain an output, do you provide a reproducible example (aka “reprex”)?
- Ideally, someone should be able to copy and paste a chunk of code to reproduce the problem you are talking about.
- Is your reproducible example minimal, meaning you’ve removed all the unnecessary parts to reproduce the problem?
You’ll probably find that the act of writing an effective question causes you to answer your own question! So, here are the elements of a good question:
# 1: Introduce the problem with an informative title
Be specific with your title. It should be brief, but also informative so that when others are looking at the Issues page (and they have a similar error and/or solution), they can easily find it.
- Bad title: “I need help!”
- Good title: “Getting a ‘file not found error’ when importing scotus.csv”
# 2: Summarize the problem
Introduce the problem you are having. Include what task you are trying to perform, pertinent error messages, and any solutions you’ve already attempted. This helps us narrow down and troubleshoot your problem.
# 3: Include a reproducible example
Including a minimal, complete, and verifiable example of the code you are using greatly helps us resolve your problem. You don’t need to copy all the code from your program into the comment, but include enough code that we can run it successfully until the point at which the error occurs.
# 4: Post your solution
Once you have solved the problem (either by yourself or with the help of an instructor/classmate), post the solution. This let’s us know that you have fixed the issue AND if anyone else encounters a similar error, they can refer to your solution to fix their problem.
# 5: Acknowledgments for this section
A few more tricks to deal with getting stuck
- Stop coding! Take a quick break and clear your head.
- Get out a piece of paper and map out how to solve the problem using plain words (pseudocode).
- Add print statements everywhere (old school).
- Use %debug in IPython.
- Clear your head more substantive - go for a run, take a nap, get groceries. Returning to the code with a fresh eye will solve problems more often than you would believe.
- Sleep! Coding tired is a sure way to make mistakes.
THE MOST ESSENTIAL RESOURCES
- Help: Google, Stack Overflow, Github help, Jupyter documentation, Python help
- Cheat sheets to bookmark! python basics, python basics, jupyter notebook, importing data, numpy, pandas basics and more on pandas, matplotlib, scitkit-learn, seaborn
- Coding best practices, and project management
- Anything that is bolded/underlined below is also considered essential.
Data Science (broad)
Github, Git, and Version control
Getting data and practicing ML
- Scikit (python package) can read in some data, which has data on Boston real estate, wine, a larger california housing dataset
- Essential: Pandas can read in a LOT of useful data! Data providers include: Federal Reserve (“FRED”), Ken French, NASDAQ, OECD, Qunadl, TSP, World Bank, and more!
- ML competitions with serious prizes at drivendata.org
- Essential: kaggle.com has ML competitions, some FAQs, tutorials, data and competitions
- UC Irvine has a data repo, some of these are available via scikit package
- More good sources: data.gov, data.census.gov, data.world, https://ourworldindata.org is incredible and also has many repos on Github including one that imports data via python, …
Some books you might look for