- Learning pandas(Second Edition)
- Michael Heydt
- 109字
- 2021-07-02 20:37:11
Explicit lookup by labels with .loc[]
Lookup by label can also be achieved by using the .loc[] property:

There are no problems using integer labels:

Note that .loc[] has a different behavior than .iloc[] when passing an index label that is not in the index. In that case, pandas will return a NaN value instead of throwing an exception:

What is NaN? We will see this in more detail later in the chapter, but pandas uses it for the representation of missing data or numbers that can't be found through index lookups. It also has ramifications in various statistical methods that we will also examine later in this chapter.
推薦閱讀
- Spring Boot開發與測試實戰
- ASP.NET MVC4框架揭秘
- Learning RxJava
- Web開發的貴族:ASP.NET 3.5+SQL Server 2008
- 深度學習:算法入門與Keras編程實踐
- NetBeans IDE 8 Cookbook
- 51單片機C語言開發教程
- 軟件測試教程
- Clojure for Machine Learning
- 深入理解C指針
- PHP 7從零基礎到項目實戰
- Learning JavaScript Data Structures and Algorithms(Second Edition)
- 編程改變生活:用Python提升你的能力(進階篇·微課視頻版)
- Python 3 數據分析與機器學習實戰
- Learning Ionic