Skip to content

BUG: Change output returned by _LocIndexer._convert_to_indexer to return key with greater resolution value #57646

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

Closed

Conversation

wleong1
Copy link

@wleong1 wleong1 commented Feb 27, 2024

Resolution info:

Resolution.RESO_SEC - 3 for seconds
Resolution.RESO_MIN - 4 for minute

Observation:
With the previous code, when the current entry (resolution: 4, entry: '2024-02-24 10:08') has a greater resolution value than the smallest amongst previous entries (in this case resolution: 3, entry: '2024-02-24 10:2:30'), it is shown that the key is said to exist within the list of keys within the Series even though it shouldn't. This does not happen when a smaller or equal resolution value entry is inserted into the Series.

Screenshot from 2024-02-26 13-14-10

Thought process:
With the previous code, if the current entry's resolution value is greater than the smallest resolution value amongst the previous entries, the _LocIndexer._convert_to_indexer method will only return an empty list (output of the method labels.get_loc(key)), which might be causing entries with larger resolution values not being inserted into the Series correctly.

Potential solution:
I have changed the method _LocIndexer._convert_to_indexer to return the key ('2024-02-24 10:08') instead of an empty list when the resolution value is greater than the smallest resolution value.

@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Unexpected behaviour when inserting timestamps into Series
2 participants