- Learning pandas(Second Edition)
- Michael Heydt
- 66字
- 2021-07-02 20:37:10
Specifying an index at creation
The labels in an index can be specified at the creation of the Series by using the index parameter of the constructor. The following creates a Series and assigns strings to each label of the index:
Examining the .index property, we find the following index was created:
Using this index, we can ask a question such as who is the Dad?: