Basic pd.Series arithmetic
The easiest place to start when exploring pandas algorithms is with a pd.Series
, given it is also the most basic structure provided by the pandas library. Basic arithmetic will cover the operations of addition, subtraction, multiplication, and division, and, as you will see in this section, pandas offers two ways to perform these. The first approach allows pandas to work with the +
, -
, *
, and /
operators built into the Python language, which is an intuitive way for new users coming to the library to pick up the tool. However, to cover features specific to data analysis not covered by the Python language, and to support the Chaining with .pipe approach that we will cover later in this chapter, pandas also offers pd.Series.add
, pd.Series.sub
, pd.Series.mul
, and pd.Series.div
, respectively.
The pandas library goes to great lengths to keep its API consistent across all data structures, so you will see that the knowledge from this section can be easily transferred...