October 2019
Beginner to intermediate
674 pages
16h 43m
English
A Series can also be initialized with just a scalar value. For scalar data, an index must be provided. The value will be repeated for as many index values as possible. One possible use of this method is to provide a quick and dirty method of initialization, with the Series structure to be filled in later. Let's see how to create a Series using scalar values:
In [21]: dogSeries=pd.Series('chihuahua', index=['breed', 'countryOfOrigin', 'name', 'gender'])In [22]: dogSeries = pd.Series('chihuahua', index=['breed', 'countryOfOrigin', 'name', 'gender'])In [23]: dogSeriesOut[23]:breed chihuahuacountryOfOrigin chihuahuaname chihuahuagender chihuahuadtype: object
Read now
Unlock full access