ipython-sql icon indicating copy to clipboard operation
ipython-sql copied to clipboard

ValueError: Array must be all same time zone

Open qleguennec opened this issue 6 years ago • 0 comments

I have the following error when I execute this sql query:

  %load_ext sql
  %config SqlMagic.autopandas = True
  %sql xxxx

  import IPython
  import pandas as pd
  import numpy as np
  from tabulate import tabulate

  pd.options.display.max_rows = 25

  class OrgFormatter(IPython.core.formatters.BaseFormatter):
      def __call__(self, obj):
          try:
              return tabulate(obj, headers='keys',
                              tablefmt='orgtbl', showindex='never')
          except:
              return None

  ip = get_ipython()
  ip.display_formatter.formatters['text/org'] = OrgFormatter()


  result = %sql select * from utilisateur
  %sql PERSIST result

Error:

  ValueErrorTraceback (most recent call last)
  ~/.local/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py in objects_to_datetime64ns(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object)
     1860         try:
  -> 1861             values, tz_parsed = conversion.datetime_to_datetime64(data)
     1862             # If tzaware, these values represent unix timestamps, so we

  pandas/_libs/tslibs/conversion.pyx in pandas._libs.tslibs.conversion.datetime_to_datetime64()

  ValueError: Array must be all same time zone

  During handling of the above exception, another exception occurred:

qleguennec avatar Apr 15 '19 11:04 qleguennec