我們可以使用np.where和Series.isin的組合: date_condition = ['2021-01-01 05:00:00', '2021-01-01 08:00:00', '2021-01-01 02:00:00']highlighted_rows = np.where(df['Start'].isin(date_condition), 'background-color: yellow', '')# Apply calculated styles to each column:styler = df.style.apply(lambda _: highlighted_rows)styler.to_excel('output.xlsx') # use styler to export to excel# styler # to display in NoteBook 或使用isin+Series.map: date_condition = ['2021-01-01 05:00:00', '2021-01-01 08:00:00', '2021-01-01 02:00:00']highlighted_rows = df['Start'].isin(date_condition).map({ True: 'background-color: yellow', Fals