Skip to content

Commit

Permalink
Fix bug in document-term matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Oct 22, 2017
1 parent df8fce0 commit 314b7d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dariah_topics/preprocessing.py
Expand Up @@ -269,7 +269,7 @@ def read_document_term_matrix(filepath):
Example:
>>> import tempfile
>>> with tempfile.NamedTemporaryFile(suffix='.csv') as tmpfile:
... tmpfile.write(b'this,is,an,example,text\\ndocument,1,0,1,0,1') and True
... tmpfile.write(b',this,is,an,example,text\\ndocument,1,0,1,0,1') and True
... tmpfile.flush()
... read_document_term_matrix(tmpfile.name) #doctest: +NORMALIZE_WHITESPACE
True
Expand All @@ -288,6 +288,8 @@ def read_document_term_matrix(filepath):
if 'document_id' and 'type_id' in document_term_matrix:
return document_term_matrix.set_index(['document_id', 'type_id'])
else:
document_term_matrix = document_term_matrix.set_index('Unnamed: 0')
document_term_matrix.index.name = None
return document_term_matrix


Expand Down

0 comments on commit 314b7d2

Please sign in to comment.