df_template.fillna(method='ffill').set_index(['日期', '班组', '机台']) # 只有最后一项作为每行索引 前面的才能合并单元格