Examples
A Series and a scalar:

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series([2, 3, np.nan, 5], index=[20, 30, 40, 50])
s
Out[2]:
20    2.0
30    3.0
40    NaN
50    5.0
dtype: float64
In [3]:
s.asof(30)
Out[3]:
3.0

For a sequence where, a Series is returned. The first value is NaN, because the first
element of where is before the first index value.

In [4]:
s.asof([6, 30])
Out[4]:
6     NaN
30    3.0
dtype: float64

Missing values are not considered. The following is 3.0, not NaN, even though
NaN is at the index location for 40.

In [5]:
s.asof(40)
Out[5]:
3.0

Take all columns into consideration:

In [6]:
df = pd.DataFrame({'p': [20, 30, 40, 50, 60],
                   'q': [None, None, None, None, 600]},
                  index=pd.DatetimeIndex(['2019-02-27 09:01:00',
                                          '2019-02-27 09:02:00',
                                          '2019-02-27 09:03:00',
                                          '2019-02-27 09:04:00',
                                          '2019-02-27 09:05:00']))
df.asof(pd.DatetimeIndex(['2019-02-27 09:03:30',
                          '2019-02-27 09:04:30']))
Out[6]:
p q
2019-02-27 09:03:30 NaN NaN
2019-02-27 09:04:30 NaN NaN

Take a single column into consideration:

In [7]:
df.asof(pd.DatetimeIndex(['2019-02-27 09:03:30',
                          '2019-02-27 09:04:30']),
        subset=['p'])
Out[7]:
p q
2019-02-27 09:03:30 40.0 NaN
2019-02-27 09:04:30 50.0 NaN