ENH: to_datetime support iso week year (16607)
State: closed

ENH: to_datetime support iso week year

 - [x] closes #16607 
 - [x] test added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [x] whatsnew entry


Labels:
name: Datetime
description: Datetime data dtype
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
@rosygupta : Thanks for the contribution!  A couple of things:

1) Instead of putting "yes", an "x" between the brackets will suffice, as it will render as a check-mark.

2) Your tests will need to be more comprehensive.  For starters, you should write additional tests that hit each of those `ValueError` messages that you added.
@gfyoung thanks for reviewing the PR. Is it not possible to create a PR without the tests? Also, my PR failed the build yesterday. Could you help me figure out the reason?
@gfyoung how can I squash all my commits post creating the PR. I realise its better to have a single commit in the PR instead of multiple? Should I close this PR and open a new one with another branch?
> Is it not possible to create a PR without the tests?

Not sure what you mean by this.  Could you clarify?

> Also, my PR failed the build yesterday. Could you help me figure out the reason?

Why don't we wait until your builds right now finish, and I can look.

> how can I squash all my commits post creating the PR. I realise its better to have a single commit in the PR instead of multiple? Should I close this PR and open a new one with another branch?

Aesthetically, that is true.  However, I wouldn't worry too much.  When maintainers merge, they will squash for you.  However, if you're interested, this <a href="https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git">SO link</a> should help.

And NO, do not close this PR (in general, it is always better to clean up what you've already created than it is to start from scratch).
@gfyoung Thanks for clarifying. I mean this PR will be accepted only if the tests that you recommended me to write are pushed here?
> I mean this PR will be accepted only if the tests that you recommended me to write are pushed here?

"only if" is a little strong, but at this point, those would certainly be tests I would add in order to get it closer to merge-ability.
@gfyoung that clears the doubt. The build just failed. If you could look into it. 
> The build just failed. If you could look into it.

Not entirely why the clipboard test is failing.  Seems like a spurious failure @jreback ?
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=h1) Report
> Merging [#16661](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ceaf85233d434a226b23f891465b4abfdc602e46?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16661/graphs/tree.svg?width=650&src=pr&token=eZ4WkYLtcO&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16661      +/-   ##
==========================================
+ Coverage   90.93%   90.93%   +<.01%     
==========================================
  Files         161      161              
  Lines       49266    49269       +3     
==========================================
+ Hits        44801    44804       +3     
  Misses       4465     4465
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.69% <ø> (ø)` | :arrow_up: |
| #single | `40.22% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.27% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `67.5% <0%> (+0.55%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=footer). Last update [ceaf852...89eaf1a](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=h1) Report
> Merging [#16661](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ceaf85233d434a226b23f891465b4abfdc602e46?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16661/graphs/tree.svg?src=pr&width=650&height=150&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16661      +/-   ##
==========================================
- Coverage   90.93%   90.92%   -0.02%     
==========================================
  Files         161      161              
  Lines       49266    49284      +18     
==========================================
+ Hits        44801    44811      +10     
- Misses       4465     4473       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.69% <ø> (ø)` | :arrow_up: |
| #single | `40.17% <ø> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `92.87% <0%> (-0.25%)` | :arrow_down: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `81.83% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.27% <0%> (-0.09%)` | :arrow_down: |
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `80.55% <0%> (ø)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.43% <0%> (ø)` | :arrow_up: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.13% <0%> (+0.03%)` | :arrow_up: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `67.5% <0%> (+0.55%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=footer). Last update [ceaf852...c249f66](https://codecov.io/gh/pandas-dev/pandas/pull/16661?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@gfyoung @jreback Any clue why the build is failing?
On Travis, you have style-check errors.  Code will not be merged unless it conforms with the Python style guide as per PEP8 style guidelines.  You can check yourself by install `flake8` and running the check listed in the PR template.

On Circle, it appears that your error messages don't match the ones being raised, which is a little weird given that they passed on Appveyor and Travis.  However, you should still try to figure out, if possible, why the test you're testing for doesn't work.
can you rebase / update according to comments
Hello @rosygupta! Thanks for updating the PR.



Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on July 19, 2017 at 20:15 Hours UTC
@rosygupta : These changes LGTM.  Just need to resolve the merge conflict, and it should be on its way!
IIRC this was pretty reasonable. can you rebase / update to comments?
can you rebase
closing as this is stale.