How to drop the first rows from your pandas dataframe?

In today’s quick data analysis tutorial we’ll learn how to remove the first or multiple few rows of a pandas DataFrame. Remove first rows in pandas – Summary Option 1: drop by row label Option 2: using the row index Option 3: using the iloc accessor Delete the first row in pandas – Example Let’s … Read more

How to find and highlight duplicates in pandas DataFrame?

In this tutorial we’ll learn how you can easily find duplicated rows in your Pandas DataFrame records. We will use the very handy duplicated() method on the entire DataFrame, one or more columns to see the duplicates so that we can decide whether to remove those rows as you prepare your data for further analysis. … Read more

Fix the No module named keras error in Python

Fix the Modulenotfounderror no module named keras error To fix the no module named keras exception, proceed as following: Why Python displays the ModuleNotFoundError for keras? The keras library isn’t shipped as part of the Python standard library. Same goes for the machine learning libraries such as tensorflow or sklearn and the popular Data Analysis … Read more

How to keep specific columns in a Pandas DataFrame?

In today’s tutorial we’ll go through several examples in which we’ll subset Pandas DataFrame and keep certain specific columns for our analysis. Example DataFrame We will start by defining a DataFrame which we will populate with fictitious data. You can use the provided data to follow along this tutorial. Here’s a quick view of our … Read more

How to append multiple Pandas DataFrames?

In today’s tutorial we’ll learn how to concatenate two or more DataFrames having the same columns in Pandas. This will come very handy in cases that you receive several comma separated value (CSV) files or Excel spreadsheets that you need to merge together before starting your Data Analysis process. Creating example data Let’s start by … Read more

How to sort a Pandas dataframe by month and year?

In this tutorial we’ll learn how we can order a Pandas DataFrame by datetime column values. Specifically we’ll look into how to sort data by date, month and year values. Example Data We’ll start by creating some dummy data that you can use to follow along this example. Here is our data: date language salary … Read more