Understanding Missing Values : NaN, NaT, None, and NULL
When working with real-world data, missing values are very common. While working with Python, Pandas, NumPy, or SQL, you may encounter…
Understanding Missing Values : NaN, NaT, None, and NULL
When working with real-world data, missing values are very common. While working with Python, Pandas, NumPy, or SQL, you may encounter terms like NaN, NaT, None, and NULL. At first, they all seem similar because they represent missing data, but they belong to different systems and behave differently. In this blog, I will explain each one in a simple and practical way.

Understanding Missing Values : NaN, NaT, None, and NULL
NaN (Not a Number)
NaN stands for Not a Number. NaN is used to represent missing values in numeric data. It is mainly used in NumPy and Pandas when a numeric value is missing or undefined.
NaN is a special floating-point value, and its data type is always float.
One interesting property of NaN is that it is not equal to itself.
This is why Pandas uses special functions like .isna() to detect missing values.
Example in Numpy :
import numpy as np
num = np.nan
print(type(num))
Output:
<class 'float'>
Example in Pandas :
import pandas as pd
df = pd.DataFrame({ "Marks": [85, 90, np.nan, 78] })
print(df)
Output :
Marks
0 85.0
1 90.0
2 NaN
3 78.0
NaT (Not a Time)
NaT stands for Not a Time. NaT is used to represent missing values in datetime columns. It is the datetime equivalent of NaN and is used only for time-related data.
When Pandas cannot find a valid date or the date is missing, it stores it as NaT.
Example :
import pandas as pd
df = pd.DataFrame({ "Date": ["16-02-2026", None, "16-02-2026"] })
df["Date"] = pd.to_datetime(df["Date"])
print(df)
Output :
Date
0 2026-02-16
1 NaT
2 2026-02-16
None
None is a built-in Python object that represents the absence of a value. Its data type is NoneType, and it can be used with any type of data such as numbers, strings, or objects.
When None is used in Pandas, it is automatically converted into NaN or NaT depending on the column type.
Simple Example :
num = None
print(type(x))
Output :
<class 'NoneType'>
Example in Pandas :
df = pd.DataFrame({ "Age": [25, None, 30] })
print(df)
Output :
Age
0 25.0
1 NaN
2 30.0
Here, None is automatically converted into NaN
NULL
NULL is used in SQL databases to represent missing or unknown values. It is different from 0, empty string, or False.
In SQL, NULL requires special conditions to check its presence.
When SQL data is imported into Pandas, NULL values are automatically converted into NaN or NaT.
Important: NULL cannot be checked using equals (=) Ex : marks = NULL
Example in SQL:
SELECT * FROM students WHERE marks IS NULL;
Example in Pandas :
Suppose we have this csv file:

A CSV file containing data of students
import pandas as pd
df = pd.read_csv("students.csv")
print(df)
Output:
Name Age Marks Join_Date
0 Ankit 22.0 85.0 2026-02-16
1 Rahul 21.0 NaN 2026-02-19
2 Priya NaN 91.0 NaN
3 Aman 23.0 78.0 2026-02-20
If the database contains NULL values, Pandas will show them as NaN.
*Important: In Pandas, all these missing values are treated as missing data, and we can detect them using: *df.isna() or df.isnull() both works the same**
Comparison Table: None vs NaN vs NaT vs NULL

Comparison Table: None vs NaN vs NaT vs NULL
In short, all four terms represent missing values but are used in different environments. When working with Pandas, these values are automatically handled and converted into appropriate missing value formats, making data cleaning and preprocessing easier.
메타데이터
- post_id
- affcbae67da3
- slug
- understanding-missing-values-nan-nat-none-and-null-affcbae67da3
- url
- https://medium.com/@ankitmourya9211/understanding-missing-values-nan-nat-none-and-null-affcbae67da3
- canonical_url
- https://medium.com/@ankitmourya9211/understanding-missing-values-nan-nat-none-and-null-affcbae67da3
- author_url
- https://medium.com/@ankitmourya9211
- status
- ok
- fetched_at
- 2026-06-23 03:48:11