How to test whether timezone exists in Python/pandas?
I am working with pandas’ tz_localize function to convert dates from local time to UTC: time_zone = ‘America/Santiago’ pd.to_datetime(pd.to_datetime(df[‘mydate’]).apply(lambda x: datetime.strftime(x, ‘%d-%m-%Y %H:%M:%S’))).dt.tz_localize(time_zone).dt.tz_convert(‘UTC’).dt.tz_localize(None) This works well, but now I would like to check whether the user-defined time_zone actually exists prior to passing it into tz_localize. I found lists of available countries online, but I do… Read More How to test whether timezone exists in Python/pandas?