Skip to content

Fix tzaware dates mismatch but no exception raised #18488

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

Merged
merged 8 commits into from
Nov 26, 2017

Conversation

aschade
Copy link
Contributor

@aschade aschade commented Nov 25, 2017

@aschade aschade changed the title Fix tzaware dates mismatch error Fix tzaware dates mismatch but no exception raised Nov 25, 2017
@@ -290,6 +290,24 @@ def test_precision_finer_than_offset(self):
tm.assert_index_equal(result1, expected1)
tm.assert_index_equal(result2, expected2)

def test_mismatching_tz_raises_err(self):
dt1_tz = pd.Timestamp('2017-01-01', tz='US/Eastern')
Copy link
Contributor

Choose a reason for hiding this comment

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

add the issue number here as a comment

def test_mismatching_tz_raises_err(self):
dt1_tz = pd.Timestamp('2017-01-01', tz='US/Eastern')
dt1_no_tz = pd.Timestamp('2017-01-01')
dt2_tz = pd.Timestamp('2017-01-04', tz='US/Eastern')
Copy link
Contributor

Choose a reason for hiding this comment

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

can you parametrize this test (IOW pass in start, end), cases for raising include:

  • one naive, one with a tz & reversed
  • different timezones & reversed

I don't think we care about the freq here.

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Datetime Datetime data dtype Timezones Timezone data dtype labels Nov 25, 2017
@codecov
Copy link

codecov bot commented Nov 25, 2017

Codecov Report

Merging #18488 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18488      +/-   ##
==========================================
- Coverage   91.33%   91.32%   -0.02%     
==========================================
  Files         163      163              
  Lines       49752    49752              
==========================================
- Hits        45443    45436       -7     
- Misses       4309     4316       +7
Flag Coverage Δ
#multiple 89.12% <ø> (ø) ⬆️
#single 40.71% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.8% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.71% <0%> (+0.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be66ef8...925fede. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 25, 2017

Codecov Report

Merging #18488 into master will decrease coverage by 2.2%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18488      +/-   ##
==========================================
- Coverage   91.33%   89.13%   -2.21%     
==========================================
  Files         163      163              
  Lines       49752    49781      +29     
==========================================
- Hits        45443    44370    -1073     
- Misses       4309     5411    +1102
Flag Coverage Δ
#multiple 89.13% <ø> (+0.01%) ⬆️
#single ?
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/io/sql.py 46.66% <0%> (-48.14%) ⬇️
pandas/core/computation/pytables.py 62.5% <0%> (-29.88%) ⬇️
pandas/io/pytables.py 64.37% <0%> (-28.47%) ⬇️
pandas/io/feather_format.py 71.42% <0%> (-14.29%) ⬇️
pandas/core/computation/common.py 78.57% <0%> (-7.15%) ⬇️
pandas/core/computation/expr.py 84.27% <0%> (-4.39%) ⬇️
pandas/io/formats/console.py 66.66% <0%> (-3.04%) ⬇️
pandas/io/clipboard/clipboards.py 29.88% <0%> (-2.3%) ⬇️
pandas/io/formats/printing.py 87.61% <0%> (-1.77%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be66ef8...685b861. Read the comment docs.

@aschade
Copy link
Contributor Author

aschade commented Nov 25, 2017

Updated tests

@@ -290,6 +290,25 @@ def test_precision_finer_than_offset(self):
tm.assert_index_equal(result1, expected1)
tm.assert_index_equal(result2, expected2)

def test_mismatching_tz_raises_err(self):
#issue 18488
Copy link
Contributor

Choose a reason for hiding this comment

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

@aschade
Copy link
Contributor Author

aschade commented Nov 26, 2017

Gotcha, using parametrize now

@jreback jreback added this to the 0.21.1 milestone Nov 26, 2017
@jreback
Copy link
Contributor

jreback commented Nov 26, 2017

lgtm. ping on green.

@aschade
Copy link
Contributor Author

aschade commented Nov 26, 2017

@jreback all green :)

@jreback jreback merged commit d101064 into pandas-dev:master Nov 26, 2017
@jreback
Copy link
Contributor

jreback commented Nov 26, 2017

thanks @aschade

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Dec 8, 2017
TomAugspurger pushed a commit that referenced this pull request Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Error Reporting Incorrect or improved errors from pandas Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: date_range is inconsistent when given mixed tz aware and tz unaware start/end
3 participants