Skip to content

python3 test_value_counts_nunique : TypeError: unhashable type: 'NaTType' #4266

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
yarikoptic opened this issue Jul 16, 2013 · 6 comments · Fixed by #4269
Closed

python3 test_value_counts_nunique : TypeError: unhashable type: 'NaTType' #4266

yarikoptic opened this issue Jul 16, 2013 · 6 comments · Fixed by #4269
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@yarikoptic
Copy link
Contributor

on sparc 4c2d050

======================================================================
ERROR: test_value_counts_nunique (pandas.tests.test_series.TestSeries)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/deb/gits/pkg-exppsy/pandas/debian/tmp/usr/lib/python3/dist-packages/pandas/tests/test_series.py", line 2633, in test_value_counts_nunique
    result = s.value_counts()
  File "/home/yoh/deb/gits/pkg-exppsy/pandas/debian/tmp/usr/lib/python3/dist-packages/pandas/core/series.py", line 1422, in value_counts
    normalize=normalize)
  File "/home/yoh/deb/gits/pkg-exppsy/pandas/debian/tmp/usr/lib/python3/dist-packages/pandas/core/algorithms.py", line 186, in value_counts
    keys, counts = htable.value_count_object(values, mask)
  File "hashtable.pyx", line 935, in pandas.hashtable.value_count_object (pandas/hashtable.c:14937)
TypeError: unhashable type: 'NaTType'

@cpcloud
Copy link
Member

cpcloud commented Jul 16, 2013

that's a weird error....NaTType hashes an int or it hashes its datetime value.

what happens when you try just

import pandas as pd
hash(pd.NaT)

?

@jreback
Copy link
Contributor

jreback commented Jul 16, 2013

@cpcloud

i suppose in theory the NaT could fail internally if for some reason the nanosecond field were assigned to 0
then this would fallback on the datetime.hash which should still work (though might be undefined)...in any event this trivial change SHOULD fix it

@yarikoptic can you try off of the above PR #4269 to see if this fixes? I can't easily test this...

@jreback
Copy link
Contributor

jreback commented Jul 16, 2013

@yarikoptic I merged this in...hopefully will fix, if not ping us back

thanks!

@jreback jreback reopened this Jul 16, 2013
@jreback
Copy link
Contributor

jreback commented Jul 16, 2013

will leave open till @yarikoptic verifies

@jreback
Copy link
Contributor

jreback commented Jul 17, 2013

@yarikoptic resolved?

@yarikoptic
Copy link
Contributor Author

seems to be resolved

$> grep -e nosetests -e 'test_value_counts_nunique.*pandas.tests.test_series.TestSeries' ../vagus-withbs4-3.log
    cd build/; python2.7 /usr/bin/nosetests -s -v -a '!network'  pandas;
test_value_counts_nunique (pandas.tests.test_series.TestSeries) ... ok
    cd build/; python3.2 /usr/bin/nosetests -s -v -a '!network'  pandas;
test_value_counts_nunique (pandas.tests.test_series.TestSeries) ... ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants