Getting Started With Pandas: How to Import and Persist Data from Different Sources

Jeannine Proctor
CodeX
Published in
9 min readJul 3, 2023

--

In this Python session, we will walk you through the process of importing various types of data into Pandas, as well as how to get the required libraries installed.

Bilalulker, 2023

Setting up your Python environment

Before we dive into the importing process, it’s essential to have a properly set up Python environment. We recommend using Anaconda or Miniconda for managing your Python environments and packages. We are assuming you already have Python installed (if not — Python).

Installing necessary libraries

To work with Pandas and the various data formats, you’ll need to install the following libraries:

## Pandas
pip install pandas

## openpyxl (for Excel files)
pip install openpyxl

## sqlalchemy (for SQL databases)
pip install sqlalchemy

## pyreadstat (for SPSS, Stata, and SAS data)
pip install pyreadstat

## rpy2 (for R data)
pip install rpy2

Once these libraries are installed, you can import data from various sources.

--

--

Jeannine Proctor
CodeX
Writer for

Product Leader. Product Marketer. Product Analyst. Technical Product Lead. Data Scientist. Instructional Designer. Curriculum Developer. Educator.