BUG: parsed datetime string resolution incorrect
State: closed

I was working today with datetime index, you have the reso (resolutions) defined from year to nanosecond, but then you had the lines 560-570 repeating 'minute' and 'second', and working with millisecond or nanosecond raises a KeyIndex error.


- [ ] closes #38121
- [ ] closes #38077 
- [ ]  tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Datetime
description: Datetime data dtype
name: Stale

Comments:
Hello @boringow! Thanks for opening this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

* In the file [`pandas/core/indexes/datetimes.py`](https://github.com/pandas-dev/pandas/blob/a9b75cf74c8b2edbdc5153f584f5416e3b17e187/pandas/core/indexes/datetimes.py):

> [Line 572:1](https://github.com/pandas-dev/pandas/blob/a9b75cf74c8b2edbdc5153f584f5416e3b17e187/pandas/core/indexes/datetimes.py#L572): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace


Hi @arw2019 , I have only 4 months of programming experience, and not more than 3 weeks of using Github. By adding a test you mean adding a small example? can I copy paste it here on the comments?
> Hi @arw2019 , I have only 4 months of programming experience, and not more than 3 weeks of using Github.

Welcome to pandas! We encourage new contributors and we'll guide you through the process of completing the pull request.

> By adding a test you mean adding a small example? can I copy paste it here on the comments?

Can I suggest that you open a github issue with the small example and the output you expect? Reference this pull request in the issue and we'll take it from there.
Okay! I am going to do so 👍 
done :)
I added the test on the issue related to this bug, I tagged you in there, that example is from the master, and this code fixes.
Can you add "- Closes  #38121" to the description at the top of this PR? Then GitHub will link this to the issue

As per https://github.com/pandas-dev/pandas/issues/38121#issuecomment-734998420 the snippet you provided is too long/complicated - we need the reproducer to be simple and concise. Please trim it down to localize the bug you're fixing. 

Once you have a small reproducer, you will need to add that test to our testing suite, in the `pandas/tests` folder
Hi @boringow - is this still active? If so, could you please address the comments above. First things first, you'll need to write a test - see [the contributing guide](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#test-driven-development-code-writing)

> pandas is serious about testing and strongly encourages contributors to embrace test-driven development (TDD). This development process “relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test.” So, before actually writing any code, you should write your tests. Often the test can be taken from the original GitHub issue. However, it is always worth considering additional use cases and writing corresponding tests.
>
>Adding tests is one of the most common requests after code is pushed to pandas. Therefore, it is worth getting in the habit of writing tests ahead of time so this is never an issue.
>
>Like many packages, pandas uses pytest and the convenient extensions in numpy.testing.
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.
Is it finally closed?
I did a test and everything requested, but you requested more.

El dom, 24 ene 2021 a las 2:22, Andrew Wieteska (<notifications@github.com>)
escribió:

> Closed #38118 <https://github.com/pandas-dev/pandas/pull/38118>.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/38118#event-4242071920>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AOZXKJVYWY7KIF6DWRI7PLDS3NY4ZANCNFSM4UFFJJYQ>
> .
>