Lessons · Coding · intermediate · Keith Galli

Complete Python Pandas Data Science Tutorial! (2025 Updated Edition)

The video “Complete Python Pandas Data Science Tutorial! (2025 Updated Edition)” by Keith Galli as 14 lessons, with the idea explained, the code from the screen, steps to try in the practice terminal, practice problems with solutions and a quiz that leads back to the moment.

14lessons
51pieces of code
36exercises
48questions
94min of video
Open the lessons →Lesson 1 is free · Beyond Pass opens all

Also in: Türkçe

Complete Python Pandas Data Science Tutorial! (2025 Updated Edition), video by Keith Galli▶ 1:34:10 · Keith Galli
1234567891011121314
0:0014 lessons across the whole video1:34:10

You will be able to

  • Create and inspect pandas DataFrames using head, tail, info, describe, shape, and memory_usage
  • Load tabular data from CSV, Parquet, and Excel files and compare their speed and size
  • Select, filter, sort, and modify rows and columns with loc, iloc, boolean conditions, and string methods
  • Clean and reshape data by handling missing values, merging and concatenating tables, and applying custom functions
  • Summarize data with value_counts, groupby, pivot_table, shift, rank, and rolling windows
  • Use AI assistants like GitHub Copilot and ChatGPT to generate and test pandas code

Good to know first

  • Basic Python syntax such as variables, functions, and lists
  • Ability to install packages and use a terminal or virtual environment
  • Familiarity with spreadsheets and the idea of rows and columns

Syllabus

14 lessons and a final project

  1. 1

    Setting up a Python environment for pandas Free

    0:00–3:504 min of video

    You will get the course project onto your computer, create and activate a virtual environment, and install the libraries the tutorial needs. You will then open a notebook, choose that environment, and import pandas as pd.

    2 code8 build steps2 exercises3 questions
  2. 2

    Creating a DataFrame and inspecting its structure Beyond Pass

    3:50–8:405 min of video

    You will learn what a pandas DataFrame is and how to build one from a list of lists, with named columns and a named index. You will also learn the inspection tools head, tail, columns, index, info, describe, unique, shape and size.

    2 code5 build steps2 exercises3 questions
  3. 3

    Reading CSV, Parquet, and Excel files with pandas Beyond Pass

    8:40–13:405 min of video

    You will learn how to load CSV, Parquet, and Excel files into a pandas DataFrame with pd.read_csv, pd.read_parquet, and pd.read_excel, and how to pick a sheet from an Excel file. You will also see how file format affects file size and loading speed.

    3 code4 build steps3 exercises3 questions
  4. 4

    Selecting rows and columns with head, loc, iloc, and at Beyond Pass

    13:40–20:207 min of video

    You will learn how to peek at the top and bottom of a pandas DataFrame and pick out specific rows and columns with loc (by label) and iloc (by position). You will also see how to change a single value.

    6 code2 exercises4 questions
  5. 5

    Sorting data and iterating over rows Beyond Pass

    20:20–24:204 min of video

    You will learn how to sort a pandas DataFrame by one or more columns, control ascending or descending order for each column, and loop over rows with iterrows(). You will also see why pandas' built-in methods are usually better than looping.

    4 code5 build steps3 exercises4 questions
  6. 6

    Filtering Rows with Conditions, String Methods, and Regex Beyond Pass

    24:20–33:5010 min of video

    You will learn how to keep only the rows of a pandas DataFrame that match a condition, combine several conditions with & and |, and filter text columns with str.contains, including regular expressions. You will also see the query method as a shorter way to write a filter.

    4 code5 build steps2 exercises3 questions
  7. 7

    Adding, Dropping, Copying and Renaming Columns Beyond Pass

    33:50–41:308 min of video

    You will learn how to add a new column to a pandas DataFrame, including one that depends on a condition with np.where, and how to drop, rename and copy columns. You will also learn when a change modifies the original DataFrame and when it only returns a new one.

    6 code6 build steps3 exercises4 questions
  8. 8

    String splitting, datetime conversion, and apply with custom functions Beyond Pass

    41:30–50:209 min of video

    You will learn how to pull pieces out of text columns with str.split, turn text dates into datetime objects so you can read parts like the year, and add new columns with apply using a lambda or a custom function. Each idea is shown on the athletes table from the video.

    3 code4 build steps3 exercises4 questions
  9. 9

    Merging and Concatenating DataFrames Beyond Pass

    50:20–58:408 min of video

    You will learn how to join two DataFrames on a shared column with pd.merge, choosing the join type with how=, and how to stack DataFrames top to bottom with pd.concat. You will also see how to handle columns with different names and duplicate column names.

    4 code5 build steps3 exercises3 questions
  10. 10

    Handling missing values: isna, fillna, interpolate and dropna Beyond Pass

    58:40–1:04:005 min of video

    Missing values show up as NaN in pandas, and you can find them with isna, then fill them with fillna (a fixed value, the mean, or interpolation) or remove them with dropna. You also learn how to filter rows that contain missing values.

    6 code3 build steps2 exercises3 questions
  11. 11

    Counting, Grouping and Building Pivot Tables in Pandas Beyond Pass

    1:04:00–1:14:0010 min of video

    This lesson shows how to count values with value_counts, combine filters with counts, and summarise data with groupby and pivot tables in pandas. You will practise each aggregation on a small coffee-sales table and see how the results change shape.

    5 code4 build steps3 exercises4 questions
  12. 12

    Shift, Rank, Cumulative Sums and Rolling Windows in Pandas Beyond Pass

    1:14:00–1:22:138 min of video

    This lesson shows how to look backwards and across rows in a pandas DataFrame using shift, compare values with percent change, rank athletes by height, and build running totals with cumsum and rolling windows. You will practise each tool on the coffee and athlete data used in the video.

    3 code5 build steps3 exercises3 questions
  13. 13

    Pandas 2.x and the PyArrow Backend Beyond Pass

    1:22:13–1:25:303 min of video

    This lesson shows how pandas 2.x can store data with the PyArrow backend instead of the older NumPy backend. You will see how to check your pandas version, compare column types with info(), and understand why PyArrow types can make string and Boolean operations faster.

    2 code5 build steps2 exercises3 questions
  14. 14

    Using AI assistants for pandas and wrap-up Beyond Pass

    1:25:30–1:34:109 min of video

    This lesson shows how AI assistants such as Copilot Chat and ChatGPT can write pandas filters, make toy data frames to practise with, and draw plots, and how to use them wisely. It ends with a plan for continuing to practise pandas after the course.

    1 code5 build steps3 exercises4 questions

Final project

Olympic Athletes Analysis Report

Build a reproducible notebook that loads, cleans, merges and summarises Olympic athlete data (bios plus results) and answers questions about it. It uses every stage of the course: setup, loading, selecting, cleaning, grouping and checking your work.

Its 8 tasks open with Beyond Pass.

Free preview · Lesson 1 in full

Setting up a Python environment for pandas

You will get the course project onto your computer, create and activate a virtual environment, and install the libraries the tutorial needs. You will then open a notebook, choose that environment, and import pandas as pd.

0:00 to 3:50 in the video

Practice terminal

Type the lesson's commands, break things, and see why.

Playground

Run and change the code, with real Python and JavaScript.

Scratchpad

Draw and write next to the video.

The idea

Pandas is a Python library for working with tables of data, the kind you would normally keep in a spreadsheet. Before you can use it, you need Python and pandas installed in a place where the project can find them. This chapter sets that up step by step, so every later lesson runs the same way on your machine.

The easiest start is in a browser: you can open a Python notebook site and run pandas there with no installation. If you prefer working on your own computer, the video clones the course repository with git. You copy the repository link, open a terminal, go to a folder such as code, and run git clone with that link. Then you cd into the new complete-pandas-tutorial folder, which holds the data files you will use.

Next comes a virtual environment. This is a private box of Python packages for one project, so the libraries you install here do not mix with other projects. You create it once in the project folder and activate it each time you work. When it is active, your terminal prompt shows the environment's name. On Mac or Linux the video uses source tutorial/bin/activate, and on Windows you use the matching activate command for Windows.

With the environment active, install everything the course needs in one go using the requirements file: pip3 install -r requirements.txt. This reads the list of packages in the file and installs them, including pandas and its helpers. The video notes this is good practice, but you can also install packages as you go, and notebooks in the browser need no setup at all.

Finally, open the project folder in an editor such as Visual Studio Code and create a new notebook file, for example tutorial.ipynb. A notebook lets you run Python one block at a time and see the result under each block. Before running code, select the Python interpreter that belongs to your tutorial environment (in VS Code: Command+Shift+P on Mac or Control+Shift+P on Windows, then choose Select Interpreter and pick tutorial). Then run a first test: print hello world, and import pandas as pd. If that cell runs without an error, the setup works and pandas is ready to use.

Key points

  • Clone the course repo with git clone and cd into the complete-pandas-tutorial folder to get the data files. 1:11
  • A virtual environment keeps this project's packages separate from everything else on your computer. 1:55
  • Install all the course libraries at once with pip3 install -r requirements.txt while the environment is active. 2:41
  • In your notebook, select the tutorial virtual environment as the interpreter before running any code. 3:44
  • The standard first line for pandas is import pandas as pd; the alias pd is used everywhere in the course. 3:44

Code from the screen

First notebook cellpython 3:44 on screen
print("hello world")
Import pandaspython 3:44 on screen
import pandas as pd

Run in a notebook cell inside your activated tutorial environment; it works in the browser only if pandas is available there.

Build along in the practice terminal

  1. Open a terminal and move to your code folder.
    $ cd code
    You should see: The prompt shows you are in the code folder.
  2. Clone the course repository using the link copied from the video's GitHub page.
    $ git clone https://github.com/KeithGalli/complete-pandas-tutorial.git
    Cloning into 'complete-pandas-tutorial'...
    remote: Enumerating objects: 29, done.
    Resolving deltas: 100% (7/7), done.
    You should see: A new folder named complete-pandas-tutorial appears with the data files inside.
  3. Go into the new project folder.
    $ cd complete-pandas-tutorial
    You should see: The prompt now ends with complete-pandas-tutorial %.
  4. Create a virtual environment named tutorial inside the project.
    $ python3 -m venv tutorial
    You should see: A tutorial folder appears in the project with no error message.
  5. Activate the virtual environment (Mac/Linux). On Windows use tutorial\Scripts\activate instead.
    $ source tutorial/bin/activate
    You should see: The prompt shows (tutorial) at the start of the line.
  6. Install all the libraries listed in requirements.txt.
    $ pip3 install -r requirements.txt
    Installing collected packages: pytz, multipledispatch, tzdata, six, ... pandas-flavor, pyjanitor
    Successfully installed ...
    You should see: pip finishes installing packages, including pandas, with no red errors.
  7. Open the project folder in Visual Studio Code, create a file named tutorial.ipynb, then select the tutorial environment as the interpreter (Command+Shift+P or Control+Shift+P, then Select Interpreter). You should see: The notebook shows tutorial as the selected kernel or interpreter.
  8. In a notebook cell, type print("hello world") and run it, then type import pandas as pd and run it.
    $ import pandas as pd
    You should see: hello world prints and the pandas import runs with no error.

Break it on purpose

Practice terminal
$ pip3 install -r requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Why: pip looks for requirements.txt in the folder you are in. Run cd complete-pandas-tutorial first, so the file is found.
Practice terminal
$ source tutorial/bin/activate
-bash: tutorial/bin/activate: No such file or directory
Why: The environment was not created yet, or you are in the wrong folder. Run python3 -m venv tutorial inside the project folder first.

Watch out

  • A virtual environment is good practice but optional; in a browser notebook you can skip it and just run pandas. 2:27
  • Activating the environment in the terminal is not enough for the notebook: you must also select the tutorial interpreter in your editor. 3:18
  • If a notebook import of pandas fails, the notebook is probably using a different Python than the one where you installed pandas. 3:44

Practice

Do it Solution checked

Check your setup. In a terminal inside the project folder with the environment active, run the command that prints the installed pandas version, then confirm it prints a version number.

Hint

Python can import pandas and print its __version__ attribute. Run python -c with the two statements in a single line.

Solution
  1. Make sure the prompt shows (tutorial).
  2. Run: python -c "import pandas as pd; print(pd.__version__)"
  3. A version number such as 2.2.2 prints, which means pandas is installed in this environment.

A version number such as 2.x.x prints with no error.

Explain Solution checked

In your own words, explain why we create a virtual environment for a project instead of installing pandas for the whole computer.

Hint

Think about two projects needing different versions of the same library.

Solution
  1. A virtual environment keeps a project's packages separate.
  2. Two projects can then use different versions of pandas without breaking each other, and the list in requirements.txt can recreate the same setup elsewhere.

A virtual environment isolates each project's packages, so different projects can use different library versions without conflicts, and the setup is easy to reproduce from requirements.txt.

On your scratchpad

Draw three boxes labelled Project, Environment and Notebook, and arrows showing that the notebook uses the environment's Python, which has pandas installed.

Quiz

  1. Which command installs every library listed in the course's requirements file?

    1. pip3 install -r requirements.txt
    2. pip3 run requirements.txt
    3. git install requirements.txt
    4. python requirements.txt --all
    Show the answer

    A. pip3 install -r requirements.txt · The video uses pip3 install -r requirements.txt, where -r tells pip to read the package list from the file.

    2:41 watch the moment
  2. Why does the video select the tutorial interpreter in the editor after activating the environment?

    1. So the notebook uses the Python where pandas was installed
    2. So the notebook can open the internet
    3. So the data files are copied to the browser
    4. So git can clone the repo
    Show the answer

    A. So the notebook uses the Python where pandas was installed · The notebook must run with the environment's Python, otherwise it cannot find the packages you installed there.

    3:18 watch the moment
  3. What does the line import pandas as pd do?

    1. Loads pandas and gives it the short name pd
    2. Creates a new spreadsheet
    3. Installs pandas on your computer
    4. Prints the pandas version
    Show the answer

    A. Loads pandas and gives it the short name pd · The alias pd is used throughout the course to refer to pandas.

    3:44 watch the moment

Open lesson 1, with the video →

Lessons 2–14 and the final project

They open with Beyond Pass: every lesson of every course, in full. One payment: $14.99 for 90 days or $29 for a year. No subscription.

Made by Beyond from the video “Complete Python Pandas Data Science Tutorial! (2025 Updated Edition)” by Keith Galli. The video plays in YouTube's own player. Watch it on YouTube · All lessons