2
Selection and Assignment
In the previous chapter, we looked at how to create a pd.Series and pd.DataFrame, and we also looked at their relationship to the pd.Index. With a foundation in constructors, we now shift focus to the crucial processes of selection and assignment. Selection, also referred to as indexing, is considered a getter; i.e., it is used to retrieve values from a pandas object. Assignment, by contrast, is a setter that is used to update values.
The recipes in this chapter start out by showing you how to retrieve values from pd.Series and pd.DataFrame objects, with ever-increasing complexity. We will eventually introduce the pd.MultiIndex, which can be used to select data hierarchically, before finally ending with an introduction ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access