Option 1
df.set_index + df.asfreq + df.reset_index + df.loc to re-order. (This will get you 7 business days, because of initial min and max for column 'B'.)
out = df.set_index('B').asfreq('1B').reset_index().loc[:, [*'AB']]
Output:
# with `np.random.seed(0)` for reproducibility
A B
0 12 2010-01-01
1 <NA> 2010-01-04
2 <NA> 2010-01-05
3 15 2010-01-06
4 <NA> 2010-01-07
5 <NA> 2010-01-08
6 0 2010-01-11
Option 2
pd.date_range + df.reindex + df.rename_axis + reset_index + df.loc.
reindex = pd.date_range(df['B'].min(), periods=7, freq='1B')
out2 = (
df.set_index('B')
.reindex(reindex)
.rename_axis('B')
.reset_index().loc[:, [*'AB']]
)
Option 3
df.merge
out3 = df.merge(pd.DataFrame({'B': reindex}), on='B', how='right')
Option 4
df.resample + resample.asfreq (More useful if you want to fill_value or instead use resample.interpolate.)
out4 = df.set_index('B').resample('1B').asfreq().reset_index().loc[:, [*'AB']]
Equality check:
dfs = [out, out2, out3, out4]
all(df.equals(dfs[0]) for df in dfs)
# True