79269176

Date: 2024-12-10 17:36:00
Score: 1
Natty:
Report link

One method without using the index and by linearly interpolating on the additional days:

display(df)

df

df2 = pd.DataFrame({
    'A': None, 
    'B': pd.date_range('1/1/2010', periods = 7, freq = '1B') })

dico = {b:a for (a, b) in zip(df["A"], df["B"])}

df2["A"] = df2.apply(lambda row: dico.get(row["B"], np.nan) , axis=1).interpolate()
display(df2)

df2

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: rehaqds