December 2017
Intermediate to advanced
386 pages
10h 42m
English
The simplest constructor for a Series object takes as argument a Python iterable, as shown in the first example, reproduced as follows:
series1 = pd.Series(['Alice', 'Bob', 'Joe', 'Mary'])series1
The iterable must be one-dimensional, such as a plain list, a NumPy array, or a file object with a stream of data. The preceding code will create the following Series object:
0 Alice 1 Bob 2 Joe 3 Mary dtype: object
The first column in the display is the index, which is a pandas object of type Index. The default index uses integers, starting at 0. Also notice that a Series object has a specific data type, represented by a NumPy dtype object. In this example, the data in the Series object consists of strings, so the dtype is object ...
Read now
Unlock full access