Today you’ll learn how to use Git, which is distributed version control system that interacts with our Github or Gitlab to ensure that our code is stored and safeguarded against human errors.
I recommend getting started and setup by going through my article here: https://gefyra.co/how-to-setup-github-with-your-ssh-keys-in-your-mac-os-terminal/
We’ll get started with additional Python deep dives first before getting started with Git.
Always activate your conda dev
environment before getting started with code, because the dev
environment is where we will be installing all our Python dependencies for future classes: conda activate dev
Cereal Cleaner
Let’s open up the README.md
file in the 01-Evr_CerealCleaner
folder to get started.
Dictionaries
Let’s open up the file in the 02-Ins_Dicts
to get started.
- Dictionaries are associative arrays where we use names as indices.
- In layman terms, “associative” just means we can use strings or human-readable words as indices within an array instead of using incremental integers.
- We call the relationship between the index and the value as a “key-value pair”. The key is the index with which we access the data within the dictionary.
- Dictionaries in Python will become part and parcel of your life if you’re into data analysis.
Students Do: Hobby Book: Dictionaries
Let’s open up the README.md
file in the 03-Stu_HobbyBook-Dictionaries
folder to get started.
List Comprehensions
Let’s open up the README.md
file in the 04-Evr_List_Comprehensions
folder to get started.
- List comprehensions is a short-form way to apply transformation while iterating a list.
- It can be important when you’re learning data analysis where your team mates might use it to clean data.
- It is a glorified way of doing loops. But it is nothing more than what you’ve learned in the past, except that it looks fancy.
- If your list comprehension is too complicated, use a for loop instead.
- Code readability is more important than being fancy in the real-world.
- I have rejected code and ask engineers to redo their work if they compromise on code readability when they try too hard to impress.
- In the real-world, we don’t want to spend so much time trying to decrypt what you have crafted. We want to get to the value of your work instead of solving puzzles.
- Code readability is more important than being fancy in the real-world.
Students Do: List Comprehensions
Let’s open up the file in the 05-Stu_List_Comprehensions
to get started.
Functions
Let’s open up the file in the 06-Ins_Functions
to get started.
Students Do: Functions
Look at the README.md
to start your activity in the 07-Stu_Functions
folder.
Graduating Functions
Let’s open up the file in the 08-Evr_GraduatingFunctions
to get started.
Intro to Git
Git doesn’t truly contribute to your data analysis skills, but it is important to know. I do not know any company who does not use Git to version-control and safeguard their work, and you’ll need to be able to store and contribute code effectively in this line of work.
You don’t need to be an ace in Git. All you need to ensure is:
- You’re storing copies of your work as you develop your analysis, be it in your local machine or within the cloud.
- When you’re contributing code, there might be existing code there. You need to learn how to manage conflicts in code if your team mate and you are contributing code in the same file.
- It is okay not to get this at the start.
This is also not a topic that you can master without working with your others. My students repeatedly said that they didn’t understand until they started a project and contributed code together into a single repository.
School’s notes mandate that I share this as a reference for additional information: https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F
Everyone Do: Adding Files from the Command Line
Look at the README.md
to start your activity in the 09-Stu_AddingMoreToTheRepo
folder.