32c6e83b4cccc35e53abcb8afb1c1fe46a528297,Orange/data/io.py,TabDelimReader,read_data,#TabDelimReader#Any#Any#,108

Before Change


    def read_data(self, filename, table):
        _X, _Y = table._X, table._Y
        _W = table._W if table._W.shape[-1] else None
        f = open(filename)
        f.readline(); f.readline(); f.readline()
        padding = [""] * self.n_columns
        if self.basket_column >= 0:
            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) // TODO how many columns?!
        table._metas = _metas = \
            np.empty((len(_X), len(self.meta_columns)), dtype=object)
        line_count = 0
        _Xr = None // To be able to delete it below even when there are no attributes
        for lne in f:
            values = lne.strip().split()
            if not values:
                continue
            if len(values) > self.n_columns:
                raise ValueError("Too many columns in line {}", 4+line_count)
            elif len(values) < self.n_columns:
                values += padding
            if self.attribute_columns:
                _Xr = _X[line_count]
                for i, (col, reader) in enumerate(self.attribute_columns):
                    _Xr[i] = reader(values[col])
            for i, (col, reader) in enumerate(self.classvar_columns):
                _Y[line_count, i] = reader(values[col])
            if _W is not None:
                _W[line_count] = float(values[self.weight_column])
            for i, (col, reader) in enumerate(self.meta_columns):
                _metas[line_count, i] = reader(values[col])
            line_count += 1
        if line_count != len(_X):
            del _Xr, _X, _Y, _W, _metas

After Change


    def read_data(self, f, table):
        _X, _Y = table._X, table._Y
        _W = table._W if table._W.shape[-1] else None
        f.seek(0)
        f.readline(); f.readline(); f.readline()
        padding = [""] * self.n_columns
        if self.basket_column >= 0:
            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) // TODO how many columns?!
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: biolab/orange3
Commit Name: 32c6e83b4cccc35e53abcb8afb1c1fe46a528297
Time: 2012-11-13
Author: anze.staric@gmail.com
File Name: Orange/data/io.py
Class Name: TabDelimReader
Method Name: read_data


Project Name: biocore/scikit-bio
Commit Name: c8fc3b5948f9d356cac1e27240fe531437c2d908
Time: 2015-10-06
Author: kestrel.gorlick@gmail.com
File Name: skbio/io/format/blast6.py
Class Name:
Method Name: _blast6_to_data_frame


Project Name: dnouri/skorch
Commit Name: 0f7823cb6a27b5d7dfab56f06a6601bf2957594b
Time: 2018-08-23
Author: stsievert@users.noreply.github.com
File Name: skorch/net.py
Class Name: NeuralNet
Method Name: __setstate__