0
Station SSD ASD EndTime
PM111 26-MAY-2021 04:30:00 PM 26-MAY-2021 05:00:00 PM 26-MAY-2021 05:10:00 PM
PM123 26-MAY-2021 07:00:00 PM 26-MAY-2021 08:00:00 PM 26-MAY-2021 08:20:00 PM
CM111 26-MAY-2021 10:00:00 PM 26-MAY-2021 10:30:00 PM 26-MAY-2021 10:40:00 PM

I would like my dataframe, df2. For Stations starting with PM***, StartTime coming from ASD column. For Stations starting with CM***, StartTime coming from SSD column.

Station StartTime EndTime
PM111 26-MAY-2021 05:00:00 PM 26-MAY-2021 05:10:00 PM
PM123 26-MAY-2021 08:00:00 PM 26-MAY-2021 08:20:00 PM
CM111 26-MAY-2021 10:00:00 PM 26-MAY-2021 10:40:00 PM
Don99
  • 159
  • 1
  • 5
  • If there are only `PM` and `CM` Stations use `df['StartTime'] = np.where(df['Station'].str.startswith('PM'), df['ASD'], df['SSD'])` – jezrael Aug 25 '21 at 09:44

0 Answers0