Skip to content

BUG: Block/DTI doesnt handle tzlocal properly #13583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jul 7, 2016

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

Unable to concatenate Series with tzlocal

s = pd.Series([pd.Timestamp('2011-01-01', tz=dateutil.tz.tzlocal())])
s
#0   2011-01-01 00:00:00+09:00
# dtype: datetime64[ns, tzlocal()]

pd.concat([s, s])
# UnknownTimeZoneError: 'tzlocal()'

It is caused by 2 issues:

1. tslib.maybe_get_tz can't handle tzlocal.

pd.tslib.maybe_get_tz('tzlocal()')
# UnknownTimeZoneError: 'tzlocal()'

2. DatetimeIndex.tz_localize may return incorrect result when tzlocal is used.

it's internally used in conat.

pd.DatetimeIndex(['2011-01-01', '2011-01-02'], tz=dateutil.tz.tzlocal()).tz_localize(None)
# DatetimeIndex(['2011-01-01', '1970-01-01'], dtype='datetime64[ns]', freq=None)

@sinhrks sinhrks added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Dtype Conversions Unexpected or buggy dtype conversions Timezones Timezone data dtype labels Jul 7, 2016
@sinhrks sinhrks added this to the 0.18.2 milestone Jul 7, 2016
@sinhrks sinhrks changed the title BUG: DTI doesnt handle tzlocal properly BUG: Block/DTI doesnt handle tzlocal properly Jul 7, 2016
@codecov-io
Copy link

codecov-io commented Jul 7, 2016

Current coverage is 84.31%

Merging #13583 into master will not change coverage

@@             master     #13583   diff @@
==========================================
  Files           138        138          
  Lines         51157      51157          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43132      43132          
  Misses         8025       8025          
  Partials          0          0          

Powered by Codecov. Last updated by ba82b51...93f59a3

@jreback
Copy link
Contributor

jreback commented Jul 10, 2016

thanks!

@sinhrks sinhrks deleted the tzlocal branch July 10, 2016 22:10
nateGeorge pushed a commit to nateGeorge/pandas that referenced this pull request Aug 15, 2016
Author: sinhrks <[email protected]>

Closes pandas-dev#13583 from sinhrks/tzlocal and squashes the following commits:

93f59a3 [sinhrks] BUG: DTI doesnt handle tzlocal properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants