Arithmetic Operations 1

Overview of numerical data types

Numerical data types are the most common ones we’ll deal with in data science and analytics. Therefore, it’s natural for us to start learning how to handle them appropriately. In pandas, the two common numerical data types used to represent numerical values are:

  • Integer data type (default dtype is int64)

  • Float data type, to represent values with decimal places (default dtype is float64)

While the examples in this lesson are primarily focused on DataFrames (given their ubiquity), note that the methods apply to Series objects as well.

Arithmetic operations

Mathematical calculations inevitably come to mind when dealing with numbers. A major step in handling and manipulating numerical data is the application of arithmetic operations. The pandas library has a series of methods that enable us to perform arithmetic operations between a DataFrame and various other objects—such as a scalar, sequence, Series, dictionary, or another DataFrame. Lets explore these methods on the numerical columns of the Iris dataset.

Get hands-on with 1200+ tech skills courses.