Christo S. Christov
Christo S. Christov

Reputation: 2309

TypeError : unhashable type

Not completely sure if it's scipy related that's why I include the python tag.

I have a grid of data. Whenever I try to access something in the grid like this :

d = pd.read_csv('Debugdata1.csv') 
d[1,:]

I get TypeError: unhashable type

Took a look at the data in a variable explorer : the Index of my data looks like this (1L,32,432 ... some more integers). Could this be the problem?

Here's the stack trace :

  File "<ipython-input-3-2f510ec7ef6f>", line 1, in <module>
    d[1,:]
  File "C:\Users\Hristo\Anaconda\lib\site-packages\pandas\core\frame.py", line 1797, in __getitem__
    return self._getitem_column(key)
  File "C:\Users\Hristo\Anaconda\lib\site-packages\pandas\core\frame.py", line 1804, in _getitem_column
    return self._get_item_cache(key)
  File "C:\Users\Hristo\Anaconda\lib\site-packages\pandas\core\generic.py", line 1082, in _get_item_cache
    res = cache.get(item)

Upvotes: 1

Views: 4150

Answers (1)

lanenok
lanenok

Reputation: 2749

Since you are using pandas module, you access elements with loc or iloc or ix. In your case

d.iloc[1,:]

or

d.ix[1,:]

Upvotes: 2

Related Questions