How to do it...

To proceed with the recipe, let's import pandas and then create a toy dataframe with two variables, each one containing a date and time in different time zones:

  1. Import pandas:
import pandas as pd
  1. Let's create a toy dataframe with one variable with values in different time zones:
df = pd.DataFrame()df['time1'] = pd.concat([    pd.Series(        pd.date_range(            start='2015-06-10 09:00', freq='H', periods=3,            tz='Europe/Berlin')),    pd.Series(        pd.date_range(            start='2015-09-10 09:00', freq='H', periods=3,             tz='US/Central'))    ], axis=0)
  1. Now, let's add another datetime variable to the dataframe, which also contains values in different time zones, and then display the resulting dataframe:
df['time2'] = pd.concat([    pd.Series( pd.date_range( ...

Get Python Feature Engineering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.