title: How to loop similar python pandas code across multiple columns
body: <p>I have written a code to extract Month, Hour, Weekday from one of the timestamp columns. i would like to apply the same code across other timestamp columns on my data without rewritting the code.</p>
  
  <pre><code>df['closed_at'] = pd.to_datetime(df['closed_at'], errors='coerce')
  df['closed_at - Month-Year'] = df['closed_at'].dt.to_period('M')
  df['closed_at - Weekday Num'] = df['closed_at'].dt.dayofweek + 1
  df['closed_at - Weekday'] = df['closed_at'].dt.weekday_name
  df['closed_at - Weekday Combo'] = df['closed_at - Weekday Num'].astype(str)+'-'+df['closed_at - Weekday']
  df['closed_at - Hour Num'] = df['closed_at'].dt.hour
  
  </code></pre>