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

Creating series

We can create series from array-like objects; these include lists, tuples, and NumPy ndarray objects. We can also create a series from a Python dict. Another way to add an index to a series is to create one by passing either an index or an array-like object of unique hashable values to the index argument of the create method for the series.

We can also create an index separately. Creating an index is a lot like creating a series, but we require all values to be unique. Every series has an index; if we do not assign an index, then a simple numeric sequence starting from 0 will be used as the index. We can give a series a name by passing a string to the name argument of the series' create method. We do this so that, if we were ...

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