Getting Started with Data Analysis
See what people answer with data and the projects you'll build in this course, then set up Python, VS Code and Git on your Windows or Mac computer, install pandas and notebook support in a virtual environment, and run your first notebook in VS Code. You'll learn why the order you run cells in matters, and use Git to get exercise code and hand in your work.
Updated
What Data Analysis Can Do
- What You Can Build with Python and pandas (Novice): Data analysis answers real questions with numbers, tables and charts, and this lesson shows the questions people answer with it, the tools that do the work (pandas, matplotlib and notebooks), the steps every analysis follows, and the projects you'll build in this course.
- How This Course Works (Novice): How Python for Data Analysis works on ask-codey.com, from reading a lesson and trying its Do It to exercises with a notebook to explore and a module pytest checks, chapter checks, module assessments and the projects you build.
Setting Up for Data Work
- Setup on Windows: Python, VS Code and Git (Novice): Install Python with the Python Install Manager, VS Code with its Python extension, and Git on Windows with winget, check them with py --version and python --version in VS Code's terminal, tell Git your name and email, and make a python-course folder.
- Setup on a Mac: Python, VS Code and Git (Novice): Install Homebrew, then Python, VS Code with its Python extension, Git and Git Credential Manager on a Mac, check Python with python3 --version in VS Code's terminal, see why the command is python3 on a Mac, tell Git your name and email, and make a python-course folder.
- Finding Your Way in the Terminal (Novice): The terminal is where you run Python programs, and four commands that work the same in PowerShell and zsh, pwd, ls, cd and mkdir, tell you which folder you're in, show what's there, move you to another folder and make a new one.
- Virtual Environments and pip (Apprentice): A virtual environment gives each Python project its own private set of packages, pip installs packages into it from PyPI, and a requirements.txt with exact versions lets any computer install the same set with one command.
- Setup: pandas and Notebook Support (Novice): Python doesn't come with pandas, so every data project lists its packages in a requirements.txt (pandas, matplotlib, openpyxl, ipykernel and pytest), installs them into its own virtual environment with pip, checks pandas.__version__, and adds VS Code's Jupyter extension for notebooks.
Notebooks
- Notebooks: Code, Results and Notes Together (Novice): A notebook is a file of cells, code cells and Markdown cells, that keeps each cell's result saved under it, like a scientist's lab notebook; an .ipynb file holds all of it as JSON, notebooks suit exploring and showing data, and a .py file suits code you reuse and test.
- Your First Notebook in VS Code (Novice): Make a notebook in VS Code, choose the project's .venv Python as its kernel, run code cells with Shift+Enter, see that a cell shows its last line's value while print() shows every line it prints, add a Markdown cell, and save the code, results and notes in one .ipynb file.
- The Kernel: Why Run Order Matters (Apprentice): A notebook's kernel remembers every name its cells made, in the order they ran rather than the order on the page, so a cell run twice or a deleted cell's variable gives answers the file can't reproduce; execution counts show the real order, Restart and Run All gives the file's true answers, the Variables view lists what the kernel remembers, and Interrupt stops a cell that runs too long.
Share Your Work with Git
- Get the Exercise Code with Git (Novice): Copy an exercise's repository from GitHub into your course folder with git clone, open the folder it makes in VS Code, and see with git status and git remote -v that your copy remembers where it came from.
- Hand In Your Work with Git (Novice): Hand in an exercise by making a public repository of your own on GitHub, pointing your clone at it with git remote set-url, saving your work with git add and git commit, sending it with git push, and submitting the repository's address.
Exercise: Bean Street's First Notebook
- Exercise: Bean Street's First Notebook (Novice): Fix a coffee chain's first notebook, whose cells are in the wrong order and which has no title, by adding a Markdown title, putting the cells in an order that runs from top to bottom, running Restart and Run All and saving, then let pytest read the saved notebook and hand it in with Git.