Modifying a pandas DataFrame using the inplace parameter

In this section, we'll learn about how to modify a DataFrame using the inplace parameter. We'll first read a real dataset into pandas. We'll then introduce pandas' inplace parameter, and see how it impacts a method's execution end result. We'll also execute methods with and without inplace parameters to demonstrate the effect of inplace.

We'll start by importing the pandas module in to our Jupyter notebook, as follows:

import pandas as pd

We will then read in our dataset:

top_movies = pd.read_table('data-movies-top-grossing.csv', sep=',')

Since it's a CSV file, we are using pandas' read_csv function for this. Now that we have read in our dataset into a DataFrame, let's take a look ...

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.