- 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.
推薦閱讀
- JMeter 性能測試實戰(第2版)
- 實用防銹油配方與制備200例
- Redis Essentials
- D3.js 4.x Data Visualization(Third Edition)
- 案例式C語言程序設計實驗指導
- Solutions Architect's Handbook
- 玩轉.NET Micro Framework移植:基于STM32F10x處理器
- Learning ECMAScript 6
- Effective C++:改善程序與設計的55個具體做法(第三版)中文版(雙色)
- Jakarta EE Cookbook
- Socket.IO Cookbook
- 循序漸進Vue.js 3前端開發實戰
- Python自動化運維:技術與最佳實踐
- Illustrator CS6中文版應用教程(第二版)
- 瘋狂Java講義精粹