October 2019
Beginner to intermediate
674 pages
16h 43m
English
Consider the following series:
In [12]: currDict={'US' : 'dollar', 'UK' : 'pound', 'Germany': 'euro', 'Mexico':'peso', 'Nigeria':'naira', 'China':'yuan', 'Japan':'yen'}In [13]: currSeries = pd.Series(currDict)Out[13]:US dollarUK poundGermany euroMexico pesoNigeria nairaChina yuanJapan yenName: Currency, dtype: object
Here, the series has a defined index and name. When being converted to a DataFrame, this index is retained and the name of the Series gets assigned as a column name:
currDF = pd.DataFrame(currSeries)
The following is the output:

There are also alternative constructors for DataFrames; they can be summarized as ...
Read now
Unlock full access