def get_ndata(ofile):
 data = [next(ofile)]
 loc = 1
 if (data[0].strip()[0] == '{'):
  raise ValueError('This looks like a sparse ARFF: not supported yet')
 for i in ofile:
  loc += 1
 return loc

def get_ndata ( ofile ) : data = [ next ( ofile ) ] loc = 1 if ( data [ 0 ] . strip ( ) [ 0 ] == '{' ) : raise ValueError ( 'This looks like a sparse ARFF: not supported yet' ) for i in ofile : loc += 1 return loc
read the whole file to get number of data attributes .