Data Type Conversion

Learn about different data types and their conversions using NumPy.

Introduction

When working with data, we need to consider data types for each column. Data types are classifications assigned to each column. We'll work with integer, float, and string data types in many data-related projects.

  • We assign an integer data type to columns with positive or negative whole numbers without decimal points.

  • We assign a float data type to columns with decimal point values.

  • We assign a string data type to columns with text values.

Let's say we're working with a dataset that contains the column, age. We first need to determine the column data type; if the data type isn't appropriate, we assign a suitable one.

In pandas, the int64, float64, and object data types represent the integer, float, and string data types, respectively.

The following table outlines a list of data types supported by pandas.

Get hands-on with 1200+ tech skills courses.