- 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).
推薦閱讀
- Java逍遙游記
- Learning Python Web Penetration Testing
- Learning NServiceBus(Second Edition)
- Java EE 6 企業(yè)級應(yīng)用開發(fā)教程
- Debian 7:System Administration Best Practices
- Java開發(fā)入行真功夫
- JavaScript by Example
- Unity 5.x By Example
- KnockoutJS Starter
- Hands-On Automation Testing with Java for Beginners
- C++從入門到精通(第5版)
- 用戶體驗可視化指南
- 區(qū)塊鏈技術(shù)進階與實戰(zhàn)(第2版)
- Solutions Architect's Handbook
- Python自然語言理解:自然語言理解系統(tǒng)開發(fā)與應(yīng)用實戰(zhàn)