Introducing pandas dtypes
When working with pandas, it is vital to make sure that you assign the correct data types to the values you're working with. Otherwise, you may end up getting unexpected results or errors when running certain operations or calculating aggregations. Having a good understanding of every data type in pandas will save you a lot of time and energy as you will considerably reduce the number of errors in your code.
Data types in pandas are internal labels that a programming language uses to understand how to store and manipulate data. For example, a program needs to understand that you can add two numbers together, such as 1 + 2, to get 3. Or, if you have two strings such as "data" and "frame," they can be concatenated to get "DataFrame."
Data types in pandas are called dtypes and should not be confused with Python's data type. We shall be using both data types and dtypes interchangeably throughout this chapter.