October 2019
Beginner to intermediate
674 pages
16h 43m
English
A dictionary consists of key-value pairs. When a dictionary is used to create a Series, the keys form the index, and the values form the 1D data of the Series:
In [12]: currDict={'US' : 'dollar', 'UK' : 'pound', 'Germany': 'euro', 'Mexico':'peso', 'Nigeria':'naira', 'China':'yuan', 'Japan':'yen'}In [13]: currSeries = pd.Series(currDict)In [14]: currSeriesOut[14]:US dollarUK poundGermany euroMexico pesoNigeria nairaChina yuanJapan yendtype: object
The index of a pandas Series structure is of type pandas.core.index.Index and can be viewed as an ordered multiset.
If an index is also specified when creating the Series, then this specified index setting overrides the dictionary keys. If the specified index contains ...
Read now
Unlock full access