- Learning pandas(Second Edition)
- Michael Heydt
- 195字
- 2021-07-02 20:37:09
The .index and .values properties
Each Series object consists of a series of values and an index. The values can be accessed through the .values property:

The result from is a NumPy array object, as the following verifies:

This is called out for informational purposes. We will not examine NumPy arrays in this book. Historically, pandas did use NumPy arrays under the covers, so NumPy arrays were more important in the past, but this dependency has been removed in recent versions. But as a convenience, .values returns a NumPy array even if the underlying representation is not a NumPy array.
In addition, the index for the series can be retrieved using .index:

The type of index created by pandas is RangeIndex. This is a change in pandas from the previous version of this book, when this type of index did not exist. The RangeIndex object represents a range of values from the start to the stop value with the specified step. This is efficient for pandas, compared to the previously utilized Int64Index.
The RangeIndex is simply one type of the indexes that we will explore (much of the detail in is Chapter 6, Indexing Data).
推薦閱讀
- 極簡算法史:從數學到機器的故事
- Learning Scala Programming
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發經典名著)
- Building a Home Security System with Raspberry Pi
- 摩登創客:與智能手機和平板電腦共舞
- Bootstrap 4:Responsive Web Design
- Linux Device Drivers Development
- Mastering Drupal 8 Views
- Learning Concurrent Programming in Scala
- C#開發案例精粹
- RubyMotion iOS Develoment Essentials
- TypeScript 2.x By Example
- Penetration Testing with the Bash shell
- 前端架構設計
- 3ds Max瘋狂設計學院