Skip to content

BUG: to_datetime throws TypeError: unhashable type: 'list' even with errors='ignore' #39756

Closed
@adamerose

Description

@adamerose

I'm getting this error when I try converting certain Series to datetime using pd.to_datetime, even though I pass errors='ignore'

_ = pd.to_datetime(pd.Series([['a']]*50), errors='ignore')  # works
_ = pd.to_datetime(pd.Series([['a']]*51), errors='ignore')  # error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\pandas\core\tools\datetimes.py", line 801, in to_datetime
    cache_array = _maybe_cache(arg, format, cache, convert_listlike)
  File "C:\Python38\lib\site-packages\pandas\core\tools\datetimes.py", line 173, in _maybe_cache
    if not should_cache(arg):
  File "C:\Python38\lib\site-packages\pandas\core\tools\datetimes.py", line 137, in should_cache
    unique_elements = set(islice(arg, check_count))
TypeError: unhashable type: 'list'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions