code: def local_to_utc(df):
      
      try:
          offset_hour = -(datetime.now() - datetime.utcnow()).seconds
      except:
          offset_hour = time.altzone if time.daylight else time.timezone
  
      offset_hour = offset_hour // 3600
      offset_hour = offset_hour if offset_hour < 10 else offset_hour // 10
  
      df = df.copy()
      df.index = pd_to_datetime(df.index, utc=True) + timedelta(hours=offset_hour)
  
      return df
docs: converts naive (usually local) timezone to UTC)