- 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.
推薦閱讀
- GeoServer Cookbook
- R語(yǔ)言經(jīng)典實(shí)例(原書(shū)第2版)
- Vue.js快跑:構(gòu)建觸手可及的高性能Web應(yīng)用
- TestNG Beginner's Guide
- Data Analysis with IBM SPSS Statistics
- Python數(shù)據(jù)分析從0到1
- Linux操作系統(tǒng)基礎(chǔ)案例教程
- Scientific Computing with Scala
- 青少年學(xué)Python(第1冊(cè))
- C#應(yīng)用程序設(shè)計(jì)教程
- Learning Continuous Integration with TeamCity
- Java程序設(shè)計(jì)案例教程
- Advanced UFT 12 for Test Engineers Cookbook
- JSP程序設(shè)計(jì)與案例實(shí)戰(zhàn)(慕課版)
- Visual Basic 程序設(shè)計(jì)實(shí)踐教程