import pandas as pd – Bring Pandas to Python

Where it all begins…import pandas as pd…

If you’re going to use pandas, then you need to make sure it is included in your python environment. The way you do think is by importing pandas.

Importing pandas means bringing all of the pandas functionality to your finger tips in your python script or jupyter notebook.

Let’s break down what this statement means.

What does import pandas as pd mean?

  • Import = “Bring this functionality or library to my python script”
  • Pandas = The library you want to import, in this case, it’s pandas
  • As = The python nomenclature for creating as alias. This is a fancy way of taking a long word and referencing it as a short word
  • pd = The standard short name for referencing pandas
Import pandas as pd - How you import pandas to your python script. This picture what each word means.

In theory, you could call pandas whatever you want. 99.99% of the time I see it as “pd”, but you could name it “dog” or “cat.” Although “import pandas as cat” sounds kind of weird…

“import pandas as pd” should always be included in the top of your python script or notebook. This ensures that it is loaded from the very beginning.

In general, it’s best practice to do all of your importing at the top of your notebooks. You’ll always see it at the top with our code.

What you’re technically doing here is loading pandas into your namespace. This means you can now use the name “pandas” (or “pd” if you created an alias) within your code.

Once you do this, Pandas is ready for use! Remember, you’ll need to import pandas every time you run a script or start up a new jupyter notebook.

Check out more Pandas functions on our Pandas Page

Official Documentation