Skip to content

Commit

Permalink
more on reading IDs as int or str
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar Celma committed Jan 28, 2012
1 parent 31edee1 commit 8b37087
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions recsys/datamodel/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,17 @@ def load(self, path, force=True, sep='\t', format=None, pickle=False):
if format.has_key('ids') and (format['ids'] == int or format['ids'] == 'int'):
try:
row_id = int(row_id)
except: pass
except:
print 'Error (ID is not int) while reading: %s' % data #Just ignore that line
continue
try:
col_id = int(col_id)
except: pass
except:
print 'Error (ID is not int) while reading: %s' % data #Just ignore that line
continue
except IndexError:
print 'Error while reading: %s' % data #Just ignore that line
#raise IndexError('while reading %s' % data)
print 'Error while reading: %s' % data #Just ignore that line
continue
# Try to convert ids to int
try:
Expand Down

0 comments on commit 8b37087

Please sign in to comment.