Learn
Creating, Loading, and Selecting Data with Pandas
Importing the Pandas Module

Pandas is a Python module for working with tabular data (i.e., data in a table with rows and columns). Tabular data has a lot of the same functionality as SQL or Excel, but Pandas adds the power of Python.

In order to get access to the Pandas module, we’ll need to install the module and then import it into a Python file. To learn how to install Python modules for data analysis on your personal computer, please refer to the following Codecademy resource:

Otherwise, let’s move on! The pandas module is usually imported at the top of a Python file under the alias pd.

import pandas as pd

If we need to access the pandas module, we can do so by operating on pd.

In this lesson, you’ll learn the basics of working with a single table in Pandas, such as:

  • Create a table from scratch
  • Loading data from another file
  • Selecting certain rows or columns of a table

Note: In order for Codecademy to properly display data from Pandas, we need to import another special library:

import codecademylib

When you’re on Codecademy.com, we’ll always provide this import for you at the top of script.py.

When you’re not on Codecademy.com, you won’t need it!

Instructions

Examine the Pandas code displayed to the right in a Jupyter Notebook. For now, don’t worry about understanding every line. These are just some examples of what you’ll be able to do by the end of this lesson!

When you’re ready, continue to the next exercise!

Folder Icon

Sign up to start coding

Already have an account?