Use Pandas Like Jedi
Small yet functional tips for Pandas
If you are in the field of data science, you must have heard Pandas. It is the most commonly used data analysis and manipulation library.
The functions and methods of Pandas make it very simple and efficient to work with tabular data.
In this post, we will cover 4 small tips that further expedite the data analysis process. Together with the basic operations, these small tips can make you use Pandas like Jedi.
I will do a few examples for each tip so that it is well understood. I will use the grocery and direct marketing datasets available on Kaggle to do examples.
Let’s start by importing Pandas along with NumPy and read the datasets into a dataframe.
import numpy as np
import pandas as pdgroceries = pd.read_csv("/content/Groceries_dataset.csv")
marketing = pd.read_csv("/content/DirectMarketing.csv")
The grocery dataset contains some shopping data. The columns show the member number, date of shopping, and purchased items.
The marketing dataset contains customer and sales information about a marketing campaign.