Dot notation

There is another way to create a new series out of a subset of data selected from a DataFrame. This method is called dot notation. In this method, the column name is passed to the DataFrame like when passing a property, rather than as a parameter:

data.State

The following is the output:

We can select multiple series, and create new series out of those. We will create a new series using the three columns  County, Metro, and State. We then concatenate these series and create a column in the DataFrame, called Address. Let's take a look at the newly created column or series we just created:

data['Address'] = data.County + ', ' + data.Metro + ', ' + data.State

The following is the output:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.214.32