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

ERR: Raise ValueError when week is passed in to_datetime format witho… #17819

Merged
merged 3 commits into from
Oct 14, 2017

Conversation

reidy-p
Copy link
Contributor

@reidy-p reidy-p commented Oct 8, 2017

…ut day or year (#16774)

@gfyoung gfyoung added Error Reporting Incorrect or improved errors from pandas Datetime Datetime data dtype labels Oct 8, 2017
def test_week_without_day_and_calendar_year(self, date, format):
# GH16774

with pytest.raises(ValueError):
Copy link
Member

Choose a reason for hiding this comment

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

Instead of pytest.raises, use tm.assert_raises_regex to check for the error message as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Done.

@codecov
Copy link

codecov bot commented Oct 8, 2017

Codecov Report

Merging #17819 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17819      +/-   ##
==========================================
- Coverage   91.26%   91.24%   -0.02%     
==========================================
  Files         163      163              
  Lines       49980    49986       +6     
==========================================
- Hits        45613    45610       -3     
- Misses       4367     4376       +9
Flag Coverage Δ
#multiple 89.05% <100%> (ø) ⬆️
#single 40.24% <16.66%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/tools/datetimes.py 83.33% <100%> (+0.36%) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.74% <0%> (-0.1%) ⬇️

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 f9ba6fe...c2c8810. Read the comment docs.

@jreback jreback added this to the 0.21.0 milestone Oct 13, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. pls move where we do this check. ping on green.

@@ -254,6 +254,16 @@ def _convert_listlike(arg, box, format, name=None, tz=tz):
require_iso8601 = not infer_datetime_format
format = None

if format is not None:
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 move this check to

pandas/_libs/tslibs/strptime.pyx

its just closer to the code where we use it

@jreback
Copy link
Contributor

jreback commented Oct 14, 2017

lgtm ping on green.

@jreback jreback merged commit 9cbf895 into pandas-dev:master Oct 14, 2017
@jreback
Copy link
Contributor

jreback commented Oct 14, 2017

thanks @reidy-p

@reidy-p reidy-p deleted the to_datetime_week branch October 14, 2017 19:48
ghost pushed a commit to reef-technologies/pandas that referenced this pull request Oct 16, 2017
ghost pushed a commit to reef-technologies/pandas that referenced this pull request Oct 16, 2017
* upstream/master: (76 commits)
  CategoricalDtype construction: actually use fastpath (pandas-dev#17891)
  DEPR: Deprecate tupleize_cols in to_csv (pandas-dev#17877)
  BUG: Fix wrong column selection in drop_duplicates when duplicate column names (pandas-dev#17879)
  DOC: Adding examples to update docstring (pandas-dev#16812) (pandas-dev#17859)
  TST: Skip if no openpyxl in test_excel (pandas-dev#17883)
  TST: Catch read_html slow test warning (pandas-dev#17874)
  flake8 cleanup (pandas-dev#17873)
  TST: remove moar warnings (pandas-dev#17872)
  ENH: tolerance now takes list-like argument for reindex and get_indexer. (pandas-dev#17367)
  ERR: Raise ValueError when week is passed in to_datetime format witho… (pandas-dev#17819)
  TST: remove some deprecation warnings (pandas-dev#17870)
  Refactor index-as-string groupby tests and fix spurious warning (Bug 17383) (pandas-dev#17843)
  BUG: merging with a boolean/int categorical column (pandas-dev#17841)
  DEPR: Deprecate read_csv arguments fully (pandas-dev#17865)
  BUG: to_json - prevent various segfault conditions (GH14256) (pandas-dev#17857)
  CLN: Use pandas.core.common for None checks (pandas-dev#17816)
  BUG: set tz on DTI from fixed format HDFStore (pandas-dev#17844)
  RLS: v0.21.0rc1
  Whatsnew cleanup (pandas-dev#17858)
  DEPR: Deprecate the convert parameter completely (pandas-dev#17831)
  ...
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
Projects
None yet
3 participants