Understanding Data Types:
-
In very broad terms, data may be classified as either continuous or categorical.
-
pandas does not broadly classify data into these two categories, but rather into more specific types.
-
The following describes common pandas data types:
- float: The NumPy float type, which support missing values (np.nan).
- int: The NumPy integer type, which does not support missing values.
- If a column contains integers and you introduce a missing value (NaN), pandas automatically converts the column’s data type to float64 because NaN is a floating-point value in NumPy.
- Int64: The pandas nullable integer type, which supports missing values (pd.NA).
- object: The NumPy type for storing strings (and mixed types).
- category: The pandas type for categorical data, which does not support missing values.
- bool: The NumPy boolean type, which does not support missing values (None becomes False, np.nan becomes True).
- boolean: The pandas nullable boolean type.
- datetime64: The NumPy datetime type, which supports missing values (NaT).