ca10c185d94470054d693f19e7691523dbe3ec55,skll/data/readers.py,NDJReader,_sub_read,#NDJReader#Any#,434

Before Change


            example = json.loads(line)
            // Convert all IDs to strings initially,
            // for consistency with csv and megam formats.
            curr_id = str(example.get("id",
                                      "EXAMPLE_{}".format(example_num)))
            class_name = (safe_float(example["y"],
                                     replace_dict=self.class_map)
                          if "y" in example else None)
            example = example["x"]

            if self.ids_to_floats:
                try:
                    curr_id = float(curr_id)
                except ValueError:
                    raise ValueError(("You set ids_to_floats to true, but" +
                                      " ID {} could not be converted to " +
                                      "float").format(curr_id))

After Change


        // create a data frame; if it"s empty,
        // then return `_parse_dataframe()`, which
        // will raise an error
        df = pd.DataFrame(lines)
        if df.empty:
            return self._parse_dataframe(df, None, None)

        // if it"s PY2 and `id` is in the
        // data frame, make sure it"s a string
        if PY2 and "id" in df:
            df["id"] = df["id"].astype(str)

        // convert the features to a
        // list of dictionaries
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: EducationalTestingService/skll
Commit Name: ca10c185d94470054d693f19e7691523dbe3ec55
Time: 2019-03-05
Author: jbiggs@ets.org
File Name: skll/data/readers.py
Class Name: NDJReader
Method Name: _sub_read


Project Name: facebookresearch/Horizon
Commit Name: 9cf8f6cdf6a2008843cb37da6e34b8d10353b0bf
Time: 2019-12-12
Author: kittipat@fb.com
File Name: ml/rl/preprocessing/sparse_to_dense.py
Class Name: PythonSparseToDenseProcessor
Method Name: process


Project Name: has2k1/plotnine
Commit Name: 329dfcea129f72eb3ea741dfc343d4c28c513c69
Time: 2014-02-06
Author: jasc@gmx.net
File Name: ggplot/ggplot.py
Class Name: ggplot
Method Name: _get_layers