Basic Data Exploration in a Pandas Dataframe

K. N
4 min readMar 9, 2023

In this exercise today, we will perform some simple data exploration using pandas in python. We will use a dataset that has information about various car models. The data is in a CSV file, mtcars.csv.

The notebook for this tutorial along with the dataset can be found here.

We can start by importing pandas and loading the data into the dataframe.

import pandas as pd
data = pd.read_csv('mtcars.csv')

Now that we have our data in a dataframe, we can take a peak into the data.

data.head()

We can also quickly get some statistics on the data by using the describe function.

data.describe()

We can also get information about the columns and datatypes of each column and the count of non-null values.

data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 32 entries, 0 to 31
Data columns (total 12 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 model 32 non-null object
1 mpg 32 non-null float64
2 cyl 32 non-null…

--

--