Creating Series

A Series can be created and initialized by passing either a scalar value, a NumPy ndarray, a Python list, or a Python Dict as the data parameter of the Series constructor. This is the default parameter and does not need to be specified if it is the first item.

The index parameter of the constructor assigns a user defined index to the Series that functions similar to a database index. This index provides a means to look up elements in the Series by index label and not by the elements' position in the array.

If you do not specify an index at the creation of a Series, the Series object will construct an index automatically using integer values starting from zero and increasing by one for each item in the Series.

The simplest means of ...

Get Learning pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.