Skip to content

pd.to_datetime should_cache errors with deque #29403

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
dxe4 opened this issue Nov 4, 2019 · 3 comments · Fixed by #29846
Closed

pd.to_datetime should_cache errors with deque #29403

dxe4 opened this issue Nov 4, 2019 · 3 comments · Fixed by #29846
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@dxe4
Copy link
Contributor

dxe4 commented Nov 4, 2019

from collections import deque
pd.to_datetime(deque([Timestamp('2010-06-02 09:30:00')] * 51))

core.tools.datetimes.should_cache gives sequence index must be integer, not 'slice at unique(arg[:check_count])

if deque is not expected it would make more sense to give a better message, otherwise support?

looks like a "good first issue" ?

version 0.25+ (i think it works on 0.24 but i only tested 0.25)

@mroeschke
Copy link
Member

mroeschke commented Nov 5, 2019

I suppose this should work as a deque is list-like.

@mroeschke mroeschke added Bug Datetime Datetime data dtype labels Nov 5, 2019
@nathalier
Copy link
Contributor

Hi,
deque slice can be taken through itertools.islice() .

Which would be better - to implement slicing for deque as well or return False from core.tools.datetimes.should_cache whenever a sequence is not slicable with [:] ?

@mroeschke
Copy link
Member

I think slicing the deque is preferable to not caching when the user passes a deque. Caching should be available for all inputs ideally.

nathalier added a commit to nathalier/pandas that referenced this issue Dec 7, 2019
nathalier added a commit to nathalier/pandas that referenced this issue Dec 7, 2019
nathalier added a commit to nathalier/pandas that referenced this issue Dec 7, 2019
nathalier added a commit to nathalier/pandas that referenced this issue Dec 9, 2019
@jreback jreback added this to the 1.0 milestone Dec 10, 2019
nathalier added a commit to nathalier/pandas that referenced this issue Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants