[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help needed for pandas bug: Could anybody verify the suspicion that tzdata might have some influence?


I did some digging: 

> Maybe it's a bug in python-tz? 

Most likely: 

Pandas uses this code to get the time offset for the local time
in tslib.pyx:  

cpdef _get_utcoffset(tzinfo, obj):
        return tzinfo._utcoffset
    except AttributeError:
        return tzinfo.utcoffset(obj)

Now with 

  tz = pytz.timezone('Asia/Tokyo')
  dt = datetime.datetime(2011,1,1)

I get 

  In[76]:  tz.utcoffset(dt)
  Out[76]: datetime.timedelta(0, 32400)

  In [77]: tz._utcoffset
  Out[77]: datetime.timedelta(0, 33540)

which is exactly the 19 min difference we see, and the result  depends
on the code path taken in _get_utoffset. 


Reply to: