Skip to main content

__ Back to top

__ ` Ctrl ` \+ ` K `

[ ![pandas 2.2.1 documentation - Home](../_static/pandas.svg) ](../index.html)

Site Navigation

  * [ Getting started ](../getting_started/index.html)
  * [ User Guide ](index.html)
  * [ API reference ](../reference/index.html)
  * [ Development ](../development/index.html)
  * [ Release notes ](../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

Site Navigation

  * [ Getting started ](../getting_started/index.html)
  * [ User Guide ](index.html)
  * [ API reference ](../reference/index.html)
  * [ Development ](../development/index.html)
  * [ Release notes ](../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

  * [ 10 minutes to pandas ](10min.html)
  * [ Intro to data structures ](dsintro.html)
  * [ Essential basic functionality ](basics.html)
  * [ IO tools (text, CSV, HDF5, â¦) ](io.html)
  * [ PyArrow Functionality ](pyarrow.html)
  * [ Indexing and selecting data ](indexing.html)
  * [ MultiIndex / advanced indexing ](advanced.html)
  * [ Copy-on-Write (CoW) ](copy_on_write.html)
  * [ Merge, join, concatenate and compare ](merging.html)
  * [ Reshaping and pivot tables ](reshaping.html)
  * [ Working with text data ](text.html)
  * Working with missing data 
  * [ Duplicate Labels ](duplicates.html)
  * [ Categorical data ](categorical.html)
  * [ Nullable integer data type ](integer_na.html)
  * [ Nullable Boolean data type ](boolean.html)
  * [ Chart visualization ](visualization.html)
  * [ Table Visualization ](style.html)
  * [ Group by: split-apply-combine ](groupby.html)
  * [ Windowing operations ](window.html)
  * [ Time series / date functionality ](timeseries.html)
  * [ Time deltas ](timedeltas.html)
  * [ Options and settings ](options.html)
  * [ Enhancing performance ](enhancingperf.html)
  * [ Scaling to large datasets ](scale.html)
  * [ Sparse data structures ](sparse.html)
  * [ Frequently Asked Questions (FAQ) ](gotchas.html)
  * [ Cookbook ](cookbook.html)

  * [ __ ](../index.html)
  * [ User Guide ](index.html)
  * Working... 

#  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.

` numpy.nan  ` for NumPy data types. The disadvantage of using NumPy data
types is that the original data type will be coerced to ` np.float64  ` or `
object  ` .

    
    
    In [1]: pd.Series([1, 2], dtype=np.int64).reindex([0, 1, 2])
    Out[1]: 
    0    1.0
    1    2.0
    2    NaN
    dtype: float64
    
    In [2]: pd.Series([True, False], dtype=np.bool_).reindex([0, 1, 2])
    Out[2]: 
    0     True
    1    False
    2      NaN
    dtype: object
    

[ ` NaT  ` ](../reference/api/pandas.NaT.html#pandas.NaT "pandas.NaT") for
NumPy ` np.datetime64  ` , ` np.timedelta64  ` , and [ ` PeriodDtype  `
](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype
"pandas.PeriodDtype") . For typing applications, use ` api.types.NaTType  ` .

    
    
    In [3]: pd.Series([1, 2], dtype=np.dtype("timedelta64[ns]")).reindex([0, 1, 2])
    Out[3]: 
    0   0 days 00:00:00.000000001
    1   0 days 00:00:00.000000002
    2                         NaT
    dtype: timedelta64[ns]
    
    In [4]: pd.Series([1, 2], dtype=np.dtype("datetime64[ns]")).reindex([0, 1, 2])
    Out[4]: 
    0   1970-01-01 00:00:00.000000001
    1   1970-01-01 00:00:00.000000002
    2                             NaT
    dtype: datetime64[ns]
    
    In [5]: pd.Series(["2020", "2020"], dtype=pd.PeriodDtype("D")).reindex([0, 1, 2])
    Out[5]: 
    0    2020-01-01
    1    2020-01-01
    2           NaT
    dtype: period[