O'Reilly logo

Hands-On Data Analysis with NumPy and pandas by Curtis Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding data

After creating a series or DataFrame, we can add more data to it using the concat function or append method. We pass an object to the method containing the data that will be added to the existing object. If we are working with a DataFrame, we may be able to append new rows or new columns. We can add new columns with the concat function, and use a dict, a series, or DataFrame for concatenating. 

Let's see how we can add new information to the series or DataFrame. Let's, for example, add two new cities to the pops series, for Seattle and Denver. This is the result:

Notice that this was not done in place; that is, a new series was ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required