2025, Sep 29 01:00

Pandas NaT (Not a Time) explained: why it appears in datetime/timedelta columns and how to handle it

Learn what pandas NaT (Not a Time) means in datetime and timedelta columns, why it appears, and how to handle missing timestamps with practical code examples.

Seeing NaT in a pandas datetime column can be confusing at first glance. It looks like a special value, and it is: NaT stands for “Not a Time”. It’s the datetime and timedelta counterpart to NaN, and it shows up when a time-like value is missing.

Code example: where NaT appears

The following DataFrame has a datetime-like column with a missing entry. That missing point is represented as NaT.

import pandas as pd
work_items = pd.DataFrame({
    "asset": ["windows", "doors", "hvac"],
    "state": ["done", "done", "delayed"],
    "finished_on": [
        pd.Timestamp("2025-08-20"),
        pd.Timestamp("2025-08-21"),
        pd.NaT,
    ],
})
print(work_items)

Output:

     asset    state finished_on
0  windows     done  2025-08-20
1    doors     done  2025-08-21
2     hvac  delayed        NaT

What NaT means and why it shows up

NaT means “Not a Time”. It is the missing value marker for datetime and timedelta data, analogous to how NaN represents missing numeric data. You’ll see it in datetime and timedelta columns for missing values.

The official reference entry for pandas.NaT may currently appear unhelpful (“alias of NaT”) due to a known issue in Pandas 2.2+. Until that’s addressed, the definition is clearly documented in the missing-values guides.

NaT is the missing value for timedelta and datetime data (see below):

NaT : (N)ot-(A)-(T)ime, the time equivalent of NaN.

The user guide also describes which sentinel values pandas uses for different dtypes, including NaT for datetime-like types.

Working with missing data

Values considered “missing”

pandas uses different sentinel values to represent a missing (also referred to as NA) depending on the data type. [...]

NaT for NumPy np.datetime64, np.timedelta64, and PeriodDtype.

There also appears to be a documentation bug in Pandas 2.2+ that leaves the pandas.NaT reference page with the terse “alias of NaT” text. The discussion is tracked here: DOC: NaT - 'alias of NaT'; NA - 'alias of <NA>'. For a concise, local description, the interactive help spells it out:

In [5]: ?pd.NaT
Type:        NaTType
String form: NaT
File:        .../pandas/_libs/tslibs/nattype.cpython-311-x86_64-linux-gnu.so
Docstring:  
(N)ot-(A)-(T)ime, the time equivalent of NaN.
Examples
--------
>>> pd.DataFrame([pd.Timestamp("2023"), np.nan], columns=["col_1"])
        col_1
0  2023-01-01
1         NaT

Solution: treat NaT as the missing-value sentinel for time data

The key is understanding that NaT is the designated missing-value marker for time-like types in pandas. It’s not an error and not a string; it’s the canonical placeholder for a missing datetime or timedelta value. The following minimal example from the help text shows how a mix of a timestamp and a missing entry renders as NaT in a datetime-like column:

import pandas as pd
import numpy as np
minimal = pd.DataFrame([pd.Timestamp("2023"), np.nan], columns=["col_dt"])
print(minimal)

Output:

        col_dt
0  2023-01-01
1         NaT

Why it matters

Time series and event data often include incomplete timestamps. Recognizing NaT as “missing time” clarifies why certain entries don’t show a date or duration and helps you reason about datetime and timedelta columns without mistaking these markers for ordinary strings or numbers.

Takeaway

NaT is simply “Not a Time”, the time-equivalent of NaN. You will encounter it in pandas datetime and timedelta data whenever a value is missing. For authoritative wording and context, consult the pandas pages on Missing values and the user guide section on values considered missing, or check the interactive help for pd.NaT.

The article is based on a question from StackOverflow by wjandrea and an answer by wjandrea.