Identify and add missing rows dynamically in dataframe

Another way forward (quite similar to pdeffebach suggestion):

julia> df = DataFrame(month=["202404","202405","202406"], ac_hrs=[2,4,5], crew_hrs=[4,6,7])
3×3 DataFrame
 Row │ month   ac_hrs  crew_hrs 
     │ String  Int64   Int64    
─────┼──────────────────────────
   1 │ 202404       2         4
   2 │ 202405       4         6
   3 │ 202406       5         7

julia> coalesce.(leftjoin(DataFrame(month=["2024$(lpad(i,2,'0'))" for i in 1:6]),df;on=:month, order=:left),0)
6×3 DataFrame
 Row │ month   ac_hrs  crew_hrs 
     │ String  Int64   Int64    
─────┼──────────────────────────
   1 │ 202401       0         0
   2 │ 202402       0         0
   3 │ 202403       0         0
   4 │ 202404       2         4
   5 │ 202405       4         6
   6 │ 202406       5         7

This is not the exact OP result, but makes it easy to get there and may be enough as it is.