72e735a98644b76208d558c0b85150190594c5b1,statsmodels/tools/tools.py,,add_constant,#,281

Before Change


    if is_nonzero_const.any():
        if has_constant == "skip":
            return x
        elif has_constant == "raise":
            raise ValueError("data already contains a constant")

    x = [np.ones(x.shape[0]), x]

After Change


    if is_nonzero_const.any():
        if has_constant == "skip":
            return x
        elif has_constant == "raise":
            if ndim == 1:
                raise ValueError("data is constant.")
            else:
                columns = np.arange(x.shape[1])
                cols = ",".join([str(c) for c in columns[is_nonzero_const]])
                raise ValueError(f"Column(s) {cols} are constant.")

    x = [np.ones(x.shape[0]), x]
    x = x if prepend else x[::-1]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: statsmodels/statsmodels
Commit Name: 72e735a98644b76208d558c0b85150190594c5b1
Time: 2020-06-28
Author: kevin.sheppard@gmail.com
File Name: statsmodels/tools/tools.py
Class Name:
Method Name: add_constant


Project Name: explosion/thinc
Commit Name: 0994a6bfdff6d12da7a3e44955ab82d5b83527d9
Time: 2020-01-26
Author: ines@ines.io
File Name: thinc/types.py
Class Name:
Method Name: validate_array_dtype


Project Name: masa-su/pixyz
Commit Name: f293a29e908ad289a042cc8e906b131d4f9281ce
Time: 2019-05-26
Author: masa@weblab.t.u-tokyo.ac.jp
File Name: pixyz/distributions/poe.py
Class Name: ProductOfNormal
Method Name: prob_factorized_text