Skip to content
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

BUG: DatetimeTZBlock can't assign values near dst boundary #14146

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Sep 4, 2016

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

Value assignment doesn't work if data contains DST boundary because of internal .localize(None).

s = pd.Series(pd.date_range('2016-11-06', freq='H', periods=3, tz='US/Eastern'))
s[1] = pd.Timestamp('2011-01-01', tz='US/Eastern')
s
#0   2016-11-06 00:00:00-04:00
#1   2016-11-06 01:00:00-04:00
#2   2016-11-06 01:00:00-05:00
# dtype: datetime64[ns, US/Eastern]

@sinhrks sinhrks added Bug Dtype Conversions Unexpected or buggy dtype conversions Timezones Timezone data dtype labels Sep 4, 2016
@@ -1038,7 +1038,7 @@ def test_fillna_series_datetime64tz(self):
# datetime64tz + int => datetime64tz
# ToDo: must be object
exp = pd.Series([pd.Timestamp('2011-01-01', tz=tz),
pd.Timestamp(1).tz_localize(tz=tz),
pd.Timestamp(1, tz=tz),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both cases are incorrect. Being fixed by #14145.

@codecov-io
Copy link

codecov-io commented Sep 4, 2016

Current coverage is 85.24% (diff: 100%)

Merging #14146 into master will not change coverage

@@             master     #14146   diff @@
==========================================
  Files           140        140          
  Lines         50556      50556          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43095      43095          
  Misses         7461       7461          
  Partials          0          0          

Powered by Codecov. Last update 289cd6d...95aa6b5

@@ -2314,7 +2317,10 @@ def __init__(self, values, placement, ndim=2, **kwargs):
if dtype is not None:
if isinstance(dtype, compat.string_types):
dtype = DatetimeTZDtype.construct_from_string(dtype)
values = values.tz_localize('UTC').tz_convert(dtype.tz)

if isinstance(values, DatetimeTZBlock):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this ever hit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks never, it was needed for initial trial. Removed.

@jreback
Copy link
Contributor

jreback commented Sep 8, 2016

@sinhrks just that question from above.

@sinhrks sinhrks force-pushed the internals_datetimetz branch from ae76d87 to 95aa6b5 Compare September 10, 2016 07:38
@jreback jreback added this to the 0.19.0 milestone Sep 10, 2016
@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

thanks!

@jreback jreback closed this in 2672a79 Sep 10, 2016
@sinhrks sinhrks deleted the internals_datetimetz branch September 10, 2016 21:12
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 Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants