merge_ordered

PHOTO EMBED

Fri Jan 14 2022 10:02:02 GMT+0000 (Coordinated Universal Time)

Saved by @ahoeweler

# good for time-series data or handling missing data
# standard
pd.merge_ordered(df1, df2, on='id', suffixes=('_str1', '_str2'))

# forward-fill
# missing values are filled with information from previous row
fill_method='ffill'
content_copyCOPY