Reads a table object from given CSV file.
480804
def readTableFromCSV(f, dialect="excel"):
    
    rowNames = []
    columnNames = []
    matrix = []

    first = True
    for row in csv.reader(f, dialect):
        if first:
            columnNames = row[1:]
            first = False
        else:
            rowNames.append(row[0])
            matrix.append([float(c) for c in row[1:]])

    return Table(rowNames, columnNames, matrix)
186555
def from_file(fn, **options):
        
        if hasattr(fn, 'read'):
            return TableFu(fn, **options)
        with open(fn) as f:
            return TableFu(f, **options)
112953
def _table_to_csv(table_):
    
    f = cStringIO.StringIO()
    try:
        _write_csv(f, table_)
        return f.getvalue()
    finally:
        f.close()
1074848
def read_csv(self, csv_location, csv_configs=None):
        # type: (str, Dict[str, int]) -> List[List[str]]
        
        csv_configs = self._generate_configs_from_default(csv_configs)
        with open(csv_location, 'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            self.csv_data = list(csv_reader)
        self.csv_data = self.csv_data[csv_configs['HEADER_COLUMNS_TO_SKIP']:]
        return self.csv_data
645273
public void read(File file, Table table) throws IOException
   {
      //System.out.println("Reading " + file.getName());
      InputStream is = null;
      try
      {
         is = new FileInputStream(file);
         read(is, table);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }
13981
def read_csv(fname):
    
    values = defaultdict(list)
    with open(fname) as f:
        reader = csv.DictReader(f)
        for row in reader:
            for (k,v) in row.items():
                values[k].append(v)
    npvalues = {k: np.array(values[k]) for k in values.keys()}
    for k in npvalues.keys():
        for datatype in [np.int, np.float]:
            try:
                npvalues[k][:1].astype(datatype)
                npvalues[k] = npvalues[k].astype(datatype)
                break
            except:
                pass
    dao = DataAccessObject(npvalues)
    return dao
415063
def _read_csv(filepath, kwargs):
    """"""
    if 'delimiter' not in kwargs:
        kwargs['delimiter'] = ','
    if 'quotechar' not in kwargs:
        kwargs['quotechar'] = '"'
    if 'skiprows' not in kwargs:
        kwargs['skiprows'] = []
    if isinstance(kwargs['skiprows'], int):
        kwargs['skiprows'] = [i for i in range(kwargs['skiprows'])]
    if 'format' in kwargs:
        format_ = kwargs['format']
        kwargs.pop('format', None)
    else:
        format_ = 'default'
    skiprows = kwargs['skiprows']
    kwargs.pop('skiprows', None)

    kwargs_open = {'newline': ''}
    mode = 'r'
    if sys.version_info < (3, 0):
        kwargs_open.pop('newline', None)
        mode = 'rb'
    with open(filepath, mode, **kwargs_open) as fp:
        if format_ == 'default':
            reader = csv.reader(fp, **kwargs)
            data = EList([row for row in reader])
            data = data.remove_indices(skiprows)
        elif format_ == 'dicts':
            reader_list = csv.DictReader(fp, **kwargs)
            data = [row for row in reader_list]
        else:
            raise NotImplementedError('Format \'{}\' unknown'
                                      .format(format_))
    return data
1205433
public <T> List<T> readCSV2Objects(InputStream is, Class<T> clazz) {

        try {
            return readCSVByMapHandler(is, clazz);
        } catch (Excel4JException | IOException e) {
            throw new Excel4jReadException("read CSV Error: ", e);
        }
    }
455942
private void readTable(InputStream is, SynchroTable table) throws IOException
   {
      int skip = table.getOffset() - m_offset;
      if (skip != 0)
      {
         StreamHelper.skip(is, skip);
         m_offset += skip;
      }

      String tableName = DatatypeConverter.getString(is);
      int tableNameLength = 2 + tableName.length();
      m_offset += tableNameLength;

      int dataLength;
      if (table.getLength() == -1)
      {
         dataLength = is.available();
      }
      else
      {
         dataLength = table.getLength() - tableNameLength;
      }

      SynchroLogger.log("READ", tableName);

      byte[] compressedTableData = new byte[dataLength];
      is.read(compressedTableData);
      m_offset += dataLength;

      Inflater inflater = new Inflater();
      inflater.setInput(compressedTableData);
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
      byte[] buffer = new byte[1024];
      while (!inflater.finished())
      {
         int count;

         try
         {
            count = inflater.inflate(buffer);
         }
         catch (DataFormatException ex)
         {
            throw new IOException(ex);
         }
         outputStream.write(buffer, 0, count);
      }
      outputStream.close();
      byte[] uncompressedTableData = outputStream.toByteArray();

      SynchroLogger.log(uncompressedTableData);

      m_tableData.put(table.getName(), uncompressedTableData);
   }
259550
public <T> List<T> readCSV2Objects(String path, Class<T> clazz) {

        try (InputStream is = new FileInputStream(new File(path))) {
            return readCSVByMapHandler(is, clazz);
        } catch (IOException | Excel4JException e) {
            throw new Excel4jReadException("read [" + path + "] CSV Error: ", e);
        }
    }
862771
def csv_reader(unicode_csv_data, dialect=None, **kwargs):
    
    import csv

    dialect = dialect or csv.excel

    if is_py3:
        # Python3 supports encoding by default, so just return the object
        for row in csv.reader(unicode_csv_data, dialect=dialect, **kwargs):
            yield [cell for cell in row]

    else:
        # csv.py doesn't do Unicode; encode temporarily as UTF-8:
        reader = csv.reader(
            utf_8_encoder(unicode_csv_data), dialect=dialect, **kwargs
        )
        for row in reader:
            # decode UTF-8 back to Unicode, cell by cell:
            yield [unicode(cell, "utf-8") for cell in row]
1282468
def get_csv_reader(csvfile, dialect=csv.excel, encoding="utf-8", **kwds):
    """"""
    try:
        # pylint: disable=pointless-statement
        unicode
        return UnicodeReader(csvfile, dialect=dialect, encoding=encoding, **kwds)
    except NameError:
        return csv.reader(csvfile, dialect=dialect, **kwds)
700421
def get(self, obj, matches=None, mt=None, lt=None, eq=None):
        '''
        
        '''
        objects = []
        with gzip.open(os.path.join(self.db_path, obj._TABLE), 'rb') as table:
            header = None
            for data in csv.reader(table):
                if not header:
                    header = data
                    continue
                _obj = obj()
                for t_attr, t_data in zip(header, data):
                    t_attr, t_type = t_attr.split(':')
                    setattr(_obj, t_attr, self._to_type(t_data, t_type))
                if self.__criteria(_obj, matches=matches, mt=mt, lt=lt, eq=eq):
                    objects.append(_obj)
        return objects
365283
def read_csv_from_file(filename):
    
    logger_csvs.info("enter read_csv_from_file")
    d = {}
    l = []
    try:
        logger_csvs.info("open file: {}".format(filename))
        with open(filename, 'r') as f:
            r = csv.reader(f, delimiter=',')

            # Create a dict with X lists corresponding to X columns
            for idx, col in enumerate(next(r)):
                d[idx] = []
                d = cast_values_csvs(d, idx, col)

            # Start iter through CSV data
            for row in r:
                for idx, col in enumerate(row):
                    # Append the cell to the correct column list
                    d = cast_values_csvs(d, idx, col)

        # Make a list of lists out of the dictionary instead
        for idx, col in d.items():
            l.append(col)
    except FileNotFoundError as e:
        print('CSV FileNotFound: ' + filename)
        logger_csvs.warn("read_csv_to_columns: FileNotFound: {}, {}".format(filename, e))
    logger_csvs.info("exit read_csv_from_file")
    return l
1193345
private void readObject(java.io.ObjectInputStream s)
        throws IOException, ClassNotFoundException
    {
        // Read in the threshold, loadfactor, and any hidden stuff
        s.defaultReadObject();
        
        // Read in number of buckets and allocate the bucket array;
        int numBuckets = s.readInt();
        table = new Entry[numBuckets];
        
        // Read in size (number of Mappings)
        int size = s.readInt();
        
        // Read the keys and values, and put the mappings in the IntHashMap
        for (int i=0; i<size; i++) {
            int key = s.readInt();
            V value = (V) s.readObject();
            put(key, value);
        }
    }
315323
def _readcsv(self, path_to_csv):
        """"""
        return np.genfromtxt(path_to_csv,
                             dtype=None,
                             delimiter=',',
                             names=True)
271769
def _get_csv_reader(input_file):
    """"""
    dialect = csv.Sniffer().sniff(input_file.read(2048))
    input_file.seek(0)
    return csv_unicode.get_csv_reader(input_file, dialect)