{"action":"opened","issue":{"url":"https://api.github.com/repos/brandomr/document_cluster/issues/10","repository_url":"https://api.github.com/repos/brandomr/document_cluster","labels_url":"https://api.github.com/repos/brandomr/document_cluster/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/brandomr/document_cluster/issues/10/comments","events_url":"https://api.github.com/repos/brandomr/document_cluster/issues/10/events","html_url":"https://github.com/brandomr/document_cluster/issues/10","id":170429002,"number":10,"title":"\"'float' object has no attribute  encode\" when trying to get 6 most frequent words for a cluster","user":{"login":"el2813","id":20479431,"avatar_url":"https://avatars.githubusercontent.com/u/20479431?v=3","gravatar_id":"","url":"https://api.github.com/users/el2813","html_url":"https://github.com/el2813","followers_url":"https://api.github.com/users/el2813/followers","following_url":"https://api.github.com/users/el2813/following{/other_user}","gists_url":"https://api.github.com/users/el2813/gists{/gist_id}","starred_url":"https://api.github.com/users/el2813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/el2813/subscriptions","organizations_url":"https://api.github.com/users/el2813/orgs","repos_url":"https://api.github.com/users/el2813/repos","events_url":"https://api.github.com/users/el2813/events{/privacy}","received_events_url":"https://api.github.com/users/el2813/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-10T14:19:52Z","updated_at":"2016-08-10T14:19:52Z","closed_at":null,"body":"Hi Brandon,\r\nThank you so very much for this tutorial. It is helping me a lot. I'd like to ask you about the following line of code:  print(' %s' % frame.ix[terms[ind].split(' ')].values.tolist()[0][0].encode('utf-8', 'ignore'), end=',') When I run it, the compiler throws this error: \"AttributeError: 'float' object has no attribute 'encode'.\"  \r\n\r\nI'm working with Python2.7, by the way. My tokenized list of words looks like this: norms = [u'jamie', u'johnson', u'sword', u'middle']. \r\ndic = {'id': ids, 'norm': norms, 'cause': causes, 'cluster': clusters}\r\nframe = pd.DataFrame(dic, index = [clusters] , columns = ['id', 'norm', 'cause']\r\n\r\n\r\n I tried this line <<< frame.ix[terms[ind].split(' ')].values.tolist()[0][0, end='' >> (i.e. without the encoding part), but it gives me  NaN for each value of the 6 most frequent words.  And <<frame.ix[terms[ind].split(' ')].values.tolist()[0][1]>> And converting it to str: <<<frame.ix[str(terms[ind]).split(' ')].values). Also <<<<import sys; reload(sys); sys.setdefaultencoding(\"utf-8\")>>>. These were probably pointless things to do... since << frame.ix[terms[ind].split(' ')].values>>> is a float object. I don`t understand this line. Do you know, by any chance, a good tutorial for pandas that might explain indexing and sorting on clusters for me or how to deal with this \"float object has no attribute encode\" situation?   \r\n\r\nThank you so much for your reply! And have a great day.\r\n"}}
{"actor":{"display_login":"el2813"}}