{
    "file_diffs": [
        {
            "old_file_content": "\"\"\"Pandas DataFrame↔Table conversion helpers\"\"\"\nfrom unittest.mock import patch\n\nimport numpy as np\nfrom scipy import sparse as sp\nfrom scipy.sparse import csr_matrix\nimport pandas as pd\nfrom pandas.core.arrays import SparseArray\nfrom pandas.core.arrays.sparse.dtype import SparseDtype\nfrom pandas.api.types import (\n    is_categorical_dtype, is_object_dtype,\n    is_datetime64_any_dtype, is_numeric_dtype, is_integer_dtype\n)\n\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, StringVariable, TimeVariable,\n    ContinuousVariable,\n)\nfrom Orange.data.table import Role\n\n__all__ = ['table_from_frame', 'table_to_frame']\n\n\nclass OrangeDataFrame(pd.DataFrame):\n    _metadata = [\"orange_variables\", \"orange_weights\",\n                 \"orange_attributes\", \"orange_role\"]\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        A pandas DataFrame wrapper for one of Table's numpy arrays:\n            - sets index values corresponding to Orange's global row indices\n              e.g. ['_o1', '_o2'] (allows Orange to handle selection)\n            - remembers the array's role in the Table (attribute, class var, meta)\n            - keeps the Variable objects, and uses them in back-to-table conversion,\n              should a column name match a variable's name\n            - stores weight values (legacy)\n\n        Parameters\n        ----------\n        table : Table\n        orange_role : Role, (default=Role.Attribute)\n            When converting back to an orange table, the DataFrame will\n            convert to the right role (attrs, class vars, or metas)\n        \"\"\"\n        if len(args) <= 0 or not isinstance(args[0], Table):\n            super().__init__(*args, **kwargs)\n            return\n        table = args[0]\n        if 'orange_role' in kwargs:\n            role = kwargs.pop('orange_role')\n        elif len(args) >= 2:\n            role = args[1]\n        else:\n            role = Role.Attribute\n\n        if role == Role.Attribute:\n            data = table.X\n            vars_ = table.domain.attributes\n        elif role == Role.ClassAttribute:\n            data = table.Y\n            vars_ = table.domain.class_vars\n        else:  # if role == Role.Meta:\n            data = table.metas\n            vars_ = table.domain.metas\n\n        index = ['_o' + str(id_) for id_ in table.ids]\n        varsdict = {var._name: var for var in vars_}\n        columns = varsdict.keys()\n\n        if sp.issparse(data):\n            data = data.asformat('csc')\n            sparrays = [SparseArray.from_spmatrix(data[:, i]) for i in range(data.shape[1])]\n            data = dict(enumerate(sparrays))\n            super().__init__(data, index=index, **kwargs)\n            self.columns = columns\n            # a hack to keep Orange df _metadata in sparse->dense conversion\n            self.sparse.to_dense = self.__patch_constructor(self.sparse.to_dense)\n        else:\n            super().__init__(data=data, index=index, columns=columns, **kwargs)\n\n        self.orange_role = role\n        self.orange_variables = varsdict\n        self.orange_weights = (dict(zip(index, table.W))\n                               if table.W.size > 0 else {})\n        self.orange_attributes = table.attributes\n\n    def __patch_constructor(self, method):\n        def new_method(*args, **kwargs):\n            with patch(\n                    'pandas.DataFrame',\n                    OrangeDataFrame\n            ):\n                df = method(*args, **kwargs)\n            df.__finalize__(self)\n            return df\n\n        return new_method\n\n    @property\n    def _constructor(self):\n        return OrangeDataFrame\n\n    def to_orange_table(self):\n        return table_from_frame(self)\n\n    def __finalize__(self, other, method=None, **_):\n        \"\"\"\n        propagate metadata from other to self\n\n        Parameters\n        ----------\n        other : the object from which to get the attributes that we are going\n            to propagate\n        method : optional, a passed method name ; possibly to take different\n            types of propagation actions based on this\n\n        \"\"\"\n        if method == 'concat':\n            objs = other.objs\n        elif method == 'merge':\n            objs = other.left, other.right\n        else:\n            objs = [other]\n\n        orange_role = getattr(self, 'orange_role', None)\n        dicts = {dname: getattr(self, dname, {})\n                 for dname in ('orange_variables',\n                               'orange_weights',\n                               'orange_attributes')}\n        for obj in objs:\n            other_role = getattr(obj, 'orange_role', None)\n            if other_role is not None:\n                orange_role = other_role\n\n            for dname, dict_ in dicts.items():\n                other_dict = getattr(obj, dname, {})\n                dict_.update(other_dict)\n\n        object.__setattr__(self, 'orange_role', orange_role)\n        for dname, dict_ in dicts.items():\n            object.__setattr__(self, dname, dict_)\n\n        return self\n\n    pd.DataFrame.__finalize__ = __finalize__\n\n\ndef _is_discrete(s, force_nominal):\n    return (is_categorical_dtype(s) or\n            is_object_dtype(s) and (force_nominal or\n                                    s.nunique() < s.size ** .666))\n\n\ndef _is_datetime(s):\n    if is_datetime64_any_dtype(s):\n        return True\n    try:\n        if is_object_dtype(s):\n            pd.to_datetime(s, infer_datetime_format=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if not any(str(i).startswith('_o') for i in df.index) \\\n            and not (df.index.is_integer() and (df.index.is_monotonic_increasing\n                                                or df.index.is_monotonic_decreasing)):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, _: np.asarray(\n                s.astype('category').cat.codes.replace(-1, np.nan)\n            ))\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            s = pd.to_datetime(s, infer_datetime_format=True)\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)\n\n\ndef table_from_frame(df, *, force_nominal=False):\n    XYM, domain = vars_from_df(df, force_nominal=force_nominal)\n\n    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):\n        W = [df.orange_weights[i] for i in df.index\n             if i in df.orange_weights]\n        if len(W) != len(df.index):\n            W = None\n        attributes = df.orange_attributes\n        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()\n               for i in df.index]\n    else:\n        W = None\n        attributes = None\n        ids = None\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_from_frames(xdf, ydf, mdf):\n    dfs = xdf, ydf, mdf\n\n    if not all(df.shape[0] == xdf.shape[0] for df in dfs):\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {xdf.shape[0]} == {ydf.shape[0]} == {mdf.shape[0]})\")\n\n    xXYM, xDomain = vars_from_df(xdf, role=Role.Attribute)\n    yXYM, yDomain = vars_from_df(ydf, role=Role.ClassAttribute)\n    mXYM, mDomain = vars_from_df(mdf, role=Role.Meta)\n\n    XYM = (xXYM[0], yXYM[1], mXYM[2])\n    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)\n\n    index_iter = (filter(lambda ind: ind.startswith('_o'),\n                         set(df.index[i] for df in dfs))\n                  for i in range(len(xdf.shape[0])))\n    ids = (i[0] if len(i) == 1 else Table.new_id()\n           for i in index_iter)\n\n    attributes = {}\n    W = None\n    for df in dfs:\n        if isinstance(df, OrangeDataFrame):\n            W = [df.orange_weights[i] for i in df.index\n                 if i in df.orange_weights]\n            if len(W) != len(df.index):\n                W = None\n        else:\n            W = None\n        attributes.update(df.orange_attributes)\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_to_frame(tab, include_metas=False):\n    \"\"\"\n    Convert Orange.data.Table to pandas.DataFrame\n\n    Parameters\n    ----------\n    tab : Table\n\n    include_metas : bool, (default=False)\n        Include table metas into dataframe.\n\n    Returns\n    -------\n    pandas.DataFrame\n    \"\"\"\n\n    def _column_to_series(col, vals):\n        result = ()\n        if col.is_discrete:\n            codes = pd.Series(vals).fillna(-1).astype(int)\n            result = (col.name, pd.Categorical.from_codes(\n                codes=codes, categories=col.values, ordered=True\n            ))\n        elif col.is_time:\n            result = (col.name, pd.to_datetime(vals, unit='s').to_series().reset_index()[0])\n        elif col.is_continuous:\n            dt = float\n            # np.nan are not compatible with int column\n            if col.number_of_decimals == 0 and not np.any(np.isnan(vals)):\n                dt = int\n            result = (col.name, pd.Series(vals).astype(dt))\n        elif col.is_string:\n            result = (col.name, pd.Series(vals))\n        return result\n\n    def _columns_to_series(cols, vals):\n        return [_column_to_series(col, vals[:, i]) for i, col in enumerate(cols)]\n\n    x, y, metas = [], [], []\n    domain = tab.domain\n    if domain.attributes:\n        x = _columns_to_series(domain.attributes, tab.X)\n    if domain.class_vars:\n        y_values = tab.Y.reshape(tab.Y.shape[0], len(domain.class_vars))\n        y = _columns_to_series(domain.class_vars, y_values)\n    if domain.metas:\n        metas = _columns_to_series(domain.metas, tab.metas)\n    all_series = dict(x + y + metas)\n    all_vars = tab.domain.variables\n    if include_metas:\n        all_vars += tab.domain.metas\n    original_column_order = [var.name for var in all_vars]\n    unsorted_columns_df = pd.DataFrame(all_series)\n    return unsorted_columns_df[original_column_order]\n\n\ndef table_to_frames(table):\n    xdf = OrangeDataFrame(table, Role.Attribute)\n    ydf = OrangeDataFrame(table, Role.ClassAttribute)\n    mdf = OrangeDataFrame(table, Role.Meta)\n\n    return xdf, ydf, mdf\n\n\ndef amend_table_with_frame(table, df, role):\n    arr = Role.get_arr(role, table)\n    if arr.shape[0] != df.shape[0]:\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {arr.shape[0]} == {df.shape[0]})\")\n\n    XYM, domain = vars_from_df(df, role=role)\n\n    if role == Role.Attribute:\n        table.domain = Domain(domain.attributes,\n                              table.domain.class_vars,\n                              table.domain.metas)\n        table.X = XYM[0]\n    elif role == Role.ClassAttribute:\n        table.domain = Domain(table.domain.attributes,\n                              domain.class_vars,\n                              table.domain.metas)\n        table.Y = XYM[1]\n    else:  # if role == Role.Meta:\n        table.domain = Domain(table.domain.attributes,\n                              table.domain.class_vars,\n                              domain.metas)\n        table.metas = XYM[2]\n\n    if isinstance(df, OrangeDataFrame):\n        table.attributes.update(df.orange_attributes)\n",
            "new_file_content": "\"\"\"Pandas DataFrame↔Table conversion helpers\"\"\"\nfrom unittest.mock import patch\n\nimport numpy as np\nfrom pandas.core.dtypes.common import is_string_dtype\nfrom scipy import sparse as sp\nfrom scipy.sparse import csr_matrix\nimport pandas as pd\nfrom pandas.core.arrays import SparseArray\nfrom pandas.core.arrays.sparse.dtype import SparseDtype\nfrom pandas.api.types import (\n    is_categorical_dtype, is_object_dtype,\n    is_datetime64_any_dtype, is_numeric_dtype, is_integer_dtype\n)\n\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, StringVariable, TimeVariable,\n    ContinuousVariable,\n)\nfrom Orange.data.table import Role\n\n__all__ = ['table_from_frame', 'table_to_frame']\n\n\nclass OrangeDataFrame(pd.DataFrame):\n    _metadata = [\"orange_variables\", \"orange_weights\",\n                 \"orange_attributes\", \"orange_role\"]\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        A pandas DataFrame wrapper for one of Table's numpy arrays:\n            - sets index values corresponding to Orange's global row indices\n              e.g. ['_o1', '_o2'] (allows Orange to handle selection)\n            - remembers the array's role in the Table (attribute, class var, meta)\n            - keeps the Variable objects, and uses them in back-to-table conversion,\n              should a column name match a variable's name\n            - stores weight values (legacy)\n\n        Parameters\n        ----------\n        table : Table\n        orange_role : Role, (default=Role.Attribute)\n            When converting back to an orange table, the DataFrame will\n            convert to the right role (attrs, class vars, or metas)\n        \"\"\"\n        if len(args) <= 0 or not isinstance(args[0], Table):\n            super().__init__(*args, **kwargs)\n            return\n        table = args[0]\n        if 'orange_role' in kwargs:\n            role = kwargs.pop('orange_role')\n        elif len(args) >= 2:\n            role = args[1]\n        else:\n            role = Role.Attribute\n\n        if role == Role.Attribute:\n            data = table.X\n            vars_ = table.domain.attributes\n        elif role == Role.ClassAttribute:\n            data = table.Y\n            vars_ = table.domain.class_vars\n        else:  # if role == Role.Meta:\n            data = table.metas\n            vars_ = table.domain.metas\n\n        index = ['_o' + str(id_) for id_ in table.ids]\n        varsdict = {var._name: var for var in vars_}\n        columns = varsdict.keys()\n\n        if sp.issparse(data):\n            data = data.asformat('csc')\n            sparrays = [SparseArray.from_spmatrix(data[:, i]) for i in range(data.shape[1])]\n            data = dict(enumerate(sparrays))\n            super().__init__(data, index=index, **kwargs)\n            self.columns = columns\n            # a hack to keep Orange df _metadata in sparse->dense conversion\n            self.sparse.to_dense = self.__patch_constructor(self.sparse.to_dense)\n        else:\n            super().__init__(data=data, index=index, columns=columns, **kwargs)\n\n        self.orange_role = role\n        self.orange_variables = varsdict\n        self.orange_weights = (dict(zip(index, table.W))\n                               if table.W.size > 0 else {})\n        self.orange_attributes = table.attributes\n\n    def __patch_constructor(self, method):\n        def new_method(*args, **kwargs):\n            with patch(\n                    'pandas.DataFrame',\n                    OrangeDataFrame\n            ):\n                df = method(*args, **kwargs)\n            df.__finalize__(self)\n            return df\n\n        return new_method\n\n    @property\n    def _constructor(self):\n        return OrangeDataFrame\n\n    def to_orange_table(self):\n        return table_from_frame(self)\n\n    def __finalize__(self, other, method=None, **_):\n        \"\"\"\n        propagate metadata from other to self\n\n        Parameters\n        ----------\n        other : the object from which to get the attributes that we are going\n            to propagate\n        method : optional, a passed method name ; possibly to take different\n            types of propagation actions based on this\n\n        \"\"\"\n        if method == 'concat':\n            objs = other.objs\n        elif method == 'merge':\n            objs = other.left, other.right\n        else:\n            objs = [other]\n\n        orange_role = getattr(self, 'orange_role', None)\n        dicts = {dname: getattr(self, dname, {})\n                 for dname in ('orange_variables',\n                               'orange_weights',\n                               'orange_attributes')}\n        for obj in objs:\n            other_role = getattr(obj, 'orange_role', None)\n            if other_role is not None:\n                orange_role = other_role\n\n            for dname, dict_ in dicts.items():\n                other_dict = getattr(obj, dname, {})\n                dict_.update(other_dict)\n\n        object.__setattr__(self, 'orange_role', orange_role)\n        for dname, dict_ in dicts.items():\n            object.__setattr__(self, dname, dict_)\n\n        return self\n\n    pd.DataFrame.__finalize__ = __finalize__\n\n\ndef _is_discrete(s, force_nominal):\n    return (is_categorical_dtype(s) or\n            is_object_dtype(s) and (force_nominal or\n                                    s.nunique() < s.size ** .666))\n\n\ndef _is_datetime(s):\n    if is_datetime64_any_dtype(s):\n        return True\n    try:\n        if is_object_dtype(s):\n            pd.to_datetime(s, infer_datetime_format=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if (\n        # not range-like index - test first to skip slow startswith(_o) check\n        not (\n            df.index.is_integer()\n            and (df.index.is_monotonic_increasing or df.index.is_monotonic_decreasing)\n        )\n        # check that it does not contain Orange index\n        and (\n            # startswith is slow (for long drs) - firs check if col has strings\n            isinstance(df.index, pd.MultiIndex)\n            or not is_string_dtype(df.index)\n            or not any(str(i).startswith(\"_o\") for i in df.index)\n        )\n    ):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n\n            def to_cat(s, _):\n                x = s.astype(\"category\").cat.codes\n                # it is same than x.replace(-1, np.nan), but much faster\n                x = x.where(x != -1, np.nan)\n                return np.asarray(x)\n\n            Xexpr.append(to_cat)\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)\n\n\ndef table_from_frame(df, *, force_nominal=False):\n    XYM, domain = vars_from_df(df, force_nominal=force_nominal)\n\n    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):\n        W = [df.orange_weights[i] for i in df.index if i in df.orange_weights]\n        if len(W) != len(df.index):\n            W = None\n        attributes = df.orange_attributes\n        if isinstance(df.index, pd.MultiIndex) or not is_string_dtype(df.index):\n            # we can skip checking for Orange indices when MultiIndex an when\n            # not string dtype and so speedup the conversion\n            ids = None\n        else:\n            ids = [\n                int(i[2:])\n                if str(i).startswith(\"_o\") and i[2:].isdigit()\n                else Table.new_id()\n                for i in df.index\n            ]\n    else:\n        W = None\n        attributes = None\n        ids = None\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_from_frames(xdf, ydf, mdf):\n    dfs = xdf, ydf, mdf\n\n    if not all(df.shape[0] == xdf.shape[0] for df in dfs):\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {xdf.shape[0]} == {ydf.shape[0]} == {mdf.shape[0]})\")\n\n    xXYM, xDomain = vars_from_df(xdf, role=Role.Attribute)\n    yXYM, yDomain = vars_from_df(ydf, role=Role.ClassAttribute)\n    mXYM, mDomain = vars_from_df(mdf, role=Role.Meta)\n\n    XYM = (xXYM[0], yXYM[1], mXYM[2])\n    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)\n\n    index_iter = (filter(lambda ind: ind.startswith('_o'),\n                         set(df.index[i] for df in dfs))\n                  for i in range(len(xdf.shape[0])))\n    ids = (i[0] if len(i) == 1 else Table.new_id()\n           for i in index_iter)\n\n    attributes = {}\n    W = None\n    for df in dfs:\n        if isinstance(df, OrangeDataFrame):\n            W = [df.orange_weights[i] for i in df.index\n                 if i in df.orange_weights]\n            if len(W) != len(df.index):\n                W = None\n        else:\n            W = None\n        attributes.update(df.orange_attributes)\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_to_frame(tab, include_metas=False):\n    \"\"\"\n    Convert Orange.data.Table to pandas.DataFrame\n\n    Parameters\n    ----------\n    tab : Table\n\n    include_metas : bool, (default=False)\n        Include table metas into dataframe.\n\n    Returns\n    -------\n    pandas.DataFrame\n    \"\"\"\n\n    def _column_to_series(col, vals):\n        result = ()\n        if col.is_discrete:\n            codes = pd.Series(vals).fillna(-1).astype(int)\n            result = (col.name, pd.Categorical.from_codes(\n                codes=codes, categories=col.values, ordered=True\n            ))\n        elif col.is_time:\n            result = (col.name, pd.to_datetime(vals, unit='s').to_series().reset_index()[0])\n        elif col.is_continuous:\n            dt = float\n            # np.nan are not compatible with int column\n            if col.number_of_decimals == 0 and not np.any(np.isnan(vals)):\n                dt = int\n            result = (col.name, pd.Series(vals).astype(dt))\n        elif col.is_string:\n            result = (col.name, pd.Series(vals))\n        return result\n\n    def _columns_to_series(cols, vals):\n        return [_column_to_series(col, vals[:, i]) for i, col in enumerate(cols)]\n\n    x, y, metas = [], [], []\n    domain = tab.domain\n    if domain.attributes:\n        x = _columns_to_series(domain.attributes, tab.X)\n    if domain.class_vars:\n        y_values = tab.Y.reshape(tab.Y.shape[0], len(domain.class_vars))\n        y = _columns_to_series(domain.class_vars, y_values)\n    if domain.metas:\n        metas = _columns_to_series(domain.metas, tab.metas)\n    all_series = dict(x + y + metas)\n    all_vars = tab.domain.variables\n    if include_metas:\n        all_vars += tab.domain.metas\n    original_column_order = [var.name for var in all_vars]\n    unsorted_columns_df = pd.DataFrame(all_series)\n    return unsorted_columns_df[original_column_order]\n\n\ndef table_to_frames(table):\n    xdf = OrangeDataFrame(table, Role.Attribute)\n    ydf = OrangeDataFrame(table, Role.ClassAttribute)\n    mdf = OrangeDataFrame(table, Role.Meta)\n\n    return xdf, ydf, mdf\n\n\ndef amend_table_with_frame(table, df, role):\n    arr = Role.get_arr(role, table)\n    if arr.shape[0] != df.shape[0]:\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {arr.shape[0]} == {df.shape[0]})\")\n\n    XYM, domain = vars_from_df(df, role=role)\n\n    if role == Role.Attribute:\n        table.domain = Domain(domain.attributes,\n                              table.domain.class_vars,\n                              table.domain.metas)\n        table.X = XYM[0]\n    elif role == Role.ClassAttribute:\n        table.domain = Domain(table.domain.attributes,\n                              domain.class_vars,\n                              table.domain.metas)\n        table.Y = XYM[1]\n    else:  # if role == Role.Meta:\n        table.domain = Domain(table.domain.attributes,\n                              table.domain.class_vars,\n                              domain.metas)\n        table.metas = XYM[2]\n\n    if isinstance(df, OrangeDataFrame):\n        table.attributes.update(df.orange_attributes)\n",
            "header": {
                "file": {
                    "path": "Orange/data/pandas_compat.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "401902f4a",
                "new_commit_hash": "b37913164",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/pandas_compat.py"
            },
            "plus_file": {
                "path": "b/Orange/data/pandas_compat.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 2,
                            "length": 6
                        },
                        "new_range": {
                            "start": 2,
                            "length": 7
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "from unittest.mock import patch",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "import numpy as np",
                                "type": "context"
                            },
                            {
                                "content": "from pandas.core.dtypes.common import is_string_dtype",
                                "type": "added"
                            },
                            {
                                "content": "from scipy import sparse as sp",
                                "type": "context"
                            },
                            {
                                "content": "from scipy.sparse import csr_matrix",
                                "type": "context"
                            },
                            {
                                "content": "import pandas as pd",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "statement",
                            "name": "",
                            "content": "from pandas.core.dtypes.common import is_string_dtype",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 5,
                            "end_lineno": 5,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 170,
                            "length": 9
                        },
                        "new_range": {
                            "start": 171,
                            "length": 20
                        },
                        "section": "def vars_from_df(df, role=None, force_nominal=False):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        _role = role",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    # If df index is not a simple RangeIndex (or similar), put it into data",
                                "type": "context"
                            },
                            {
                                "content": "    if not any(str(i).startswith('_o') for i in df.index) \\",
                                "type": "deleted"
                            },
                            {
                                "content": "            and not (df.index.is_integer() and (df.index.is_monotonic_increasing",
                                "type": "deleted"
                            },
                            {
                                "content": "                                                or df.index.is_monotonic_decreasing)):",
                                "type": "deleted"
                            },
                            {
                                "content": "    if (",
                                "type": "added"
                            },
                            {
                                "content": "        # not range-like index - test first to skip slow startswith(_o) check",
                                "type": "added"
                            },
                            {
                                "content": "        not (",
                                "type": "added"
                            },
                            {
                                "content": "            df.index.is_integer()",
                                "type": "added"
                            },
                            {
                                "content": "            and (df.index.is_monotonic_increasing or df.index.is_monotonic_decreasing)",
                                "type": "added"
                            },
                            {
                                "content": "        )",
                                "type": "added"
                            },
                            {
                                "content": "        # check that it does not contain Orange index",
                                "type": "added"
                            },
                            {
                                "content": "        and (",
                                "type": "added"
                            },
                            {
                                "content": "            # startswith is slow (for long drs) - firs check if col has strings",
                                "type": "added"
                            },
                            {
                                "content": "            isinstance(df.index, pd.MultiIndex)",
                                "type": "added"
                            },
                            {
                                "content": "            or not is_string_dtype(df.index)",
                                "type": "added"
                            },
                            {
                                "content": "            or not any(str(i).startswith(\"_o\") for i in df.index)",
                                "type": "added"
                            },
                            {
                                "content": "        )",
                                "type": "added"
                            },
                            {
                                "content": "    ):",
                                "type": "added"
                            },
                            {
                                "content": "        df = df.reset_index()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    Xcols, Ycols, Mcols = [], [], []",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "function",
                            "name": "vars_from_df",
                            "content": "def vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if not any(str(i).startswith('_o') for i in df.index) \\\n            and not (df.index.is_integer() and (df.index.is_monotonic_increasing\n                                                or df.index.is_monotonic_decreasing)):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, _: np.asarray(\n                s.astype('category').cat.codes.replace(-1, np.nan)\n            ))\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            s = pd.to_datetime(s, infer_datetime_format=True)\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 166,
                            "end_lineno": 277,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 180,
                            "length": 6
                        },
                        "new_range": {
                            "start": 192,
                            "length": 7
                        },
                        "section": "def vars_from_df(df, role=None, force_nominal=False):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    attrs, class_vars, metas = [], [], []",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    contains_strings = _role == Role.Meta",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    for column in df.columns:",
                                "type": "context"
                            },
                            {
                                "content": "        s = df[column]",
                                "type": "context"
                            },
                            {
                                "content": "        if hasattr(df, 'orange_variables') and column in df.orange_variables:",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "function",
                            "name": "vars_from_df",
                            "content": "def vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if (\n        # not range-like index - test first to skip slow startswith(_o) check\n        not (\n            df.index.is_integer()\n            and (df.index.is_monotonic_increasing or df.index.is_monotonic_decreasing)\n        )\n        # check that it does not contain Orange index\n        and (\n            # startswith is slow (for long drs) - firs check if col has strings\n            isinstance(df.index, pd.MultiIndex)\n            or not is_string_dtype(df.index)\n            or not any(str(i).startswith(\"_o\") for i in df.index)\n        )\n    ):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n\n            def to_cat(s, _):\n                x = s.astype(\"category\").cat.codes\n                # it is same than x.replace(-1, np.nan), but much faster\n                x = x.where(x != -1, np.nan)\n                return np.asarray(x)\n\n            Xexpr.append(to_cat)\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 167,
                            "end_lineno": 294,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 203,
                            "length": 12
                        },
                        "new_range": {
                            "start": 216,
                            "length": 16
                        },
                        "section": "def vars_from_df(df, role=None, force_nominal=False):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                                   discrete.categories.astype(str).tolist())",
                                "type": "context"
                            },
                            {
                                "content": "            attrs.append(var)",
                                "type": "context"
                            },
                            {
                                "content": "            Xcols.append(column)",
                                "type": "context"
                            },
                            {
                                "content": "            Xexpr.append(lambda s, _: np.asarray(",
                                "type": "deleted"
                            },
                            {
                                "content": "                s.astype('category').cat.codes.replace(-1, np.nan)",
                                "type": "deleted"
                            },
                            {
                                "content": "            ))",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "            def to_cat(s, _):",
                                "type": "added"
                            },
                            {
                                "content": "                x = s.astype(\"category\").cat.codes",
                                "type": "added"
                            },
                            {
                                "content": "                # it is same than x.replace(-1, np.nan), but much faster",
                                "type": "added"
                            },
                            {
                                "content": "                x = x.where(x != -1, np.nan)",
                                "type": "added"
                            },
                            {
                                "content": "                return np.asarray(x)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "            Xexpr.append(to_cat)",
                                "type": "added"
                            },
                            {
                                "content": "        elif _is_datetime(s):",
                                "type": "context"
                            },
                            {
                                "content": "            var = TimeVariable(str(column))",
                                "type": "context"
                            },
                            {
                                "content": "            s = pd.to_datetime(s, infer_datetime_format=True)",
                                "type": "deleted"
                            },
                            {
                                "content": "            attrs.append(var)",
                                "type": "context"
                            },
                            {
                                "content": "            Xcols.append(column)",
                                "type": "context"
                            },
                            {
                                "content": "            Xexpr.append(lambda s, v: np.asarray(",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "function",
                            "name": "vars_from_df",
                            "content": "def vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if not any(str(i).startswith('_o') for i in df.index) \\\n            and not (df.index.is_integer() and (df.index.is_monotonic_increasing\n                                                or df.index.is_monotonic_decreasing)):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, _: np.asarray(\n                s.astype('category').cat.codes.replace(-1, np.nan)\n            ))\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            s = pd.to_datetime(s, infer_datetime_format=True)\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 166,
                            "end_lineno": 277,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 281,
                            "length": 13
                        },
                        "new_range": {
                            "start": 298,
                            "length": 21
                        },
                        "section": "def table_from_frame(df, *, force_nominal=False):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    XYM, domain = vars_from_df(df, force_nominal=force_nominal)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):",
                                "type": "context"
                            },
                            {
                                "content": "        W = [df.orange_weights[i] for i in df.index",
                                "type": "deleted"
                            },
                            {
                                "content": "             if i in df.orange_weights]",
                                "type": "deleted"
                            },
                            {
                                "content": "        W = [df.orange_weights[i] for i in df.index if i in df.orange_weights]",
                                "type": "added"
                            },
                            {
                                "content": "        if len(W) != len(df.index):",
                                "type": "context"
                            },
                            {
                                "content": "            W = None",
                                "type": "context"
                            },
                            {
                                "content": "        attributes = df.orange_attributes",
                                "type": "context"
                            },
                            {
                                "content": "        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()",
                                "type": "deleted"
                            },
                            {
                                "content": "               for i in df.index]",
                                "type": "deleted"
                            },
                            {
                                "content": "        if isinstance(df.index, pd.MultiIndex) or not is_string_dtype(df.index):",
                                "type": "added"
                            },
                            {
                                "content": "            # we can skip checking for Orange indices when MultiIndex an when",
                                "type": "added"
                            },
                            {
                                "content": "            # not string dtype and so speedup the conversion",
                                "type": "added"
                            },
                            {
                                "content": "            ids = None",
                                "type": "added"
                            },
                            {
                                "content": "        else:",
                                "type": "added"
                            },
                            {
                                "content": "            ids = [",
                                "type": "added"
                            },
                            {
                                "content": "                int(i[2:])",
                                "type": "added"
                            },
                            {
                                "content": "                if str(i).startswith(\"_o\") and i[2:].isdigit()",
                                "type": "added"
                            },
                            {
                                "content": "                else Table.new_id()",
                                "type": "added"
                            },
                            {
                                "content": "                for i in df.index",
                                "type": "added"
                            },
                            {
                                "content": "            ]",
                                "type": "added"
                            },
                            {
                                "content": "    else:",
                                "type": "context"
                            },
                            {
                                "content": "        W = None",
                                "type": "context"
                            },
                            {
                                "content": "        attributes = None",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "function",
                            "name": "table_from_frame",
                            "content": "def table_from_frame(df, *, force_nominal=False):\n    XYM, domain = vars_from_df(df, force_nominal=force_nominal)\n\n    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):\n        W = [df.orange_weights[i] for i in df.index\n             if i in df.orange_weights]\n        if len(W) != len(df.index):\n            W = None\n        attributes = df.orange_attributes\n        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()\n               for i in df.index]\n    else:\n        W = None\n        attributes = None\n        ids = None\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 280,
                            "end_lineno": 302,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# pylint: disable=import-outside-toplevel\n\nimport unittest\nimport numpy as np\nfrom scipy.sparse import csr_matrix\nimport scipy.sparse as sp\n\nfrom Orange.data import ContinuousVariable, DiscreteVariable, TimeVariable, Table, Domain, \\\n    StringVariable\nfrom Orange.data.pandas_compat import OrangeDataFrame\n\ntry:\n    import pandas as pd\nexcept ImportError:\n    pd = None\n\n\n@unittest.skipIf(pd is None, \"Missing package 'pandas'\")\nclass TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)\n\n\nclass TestTablePandas(unittest.TestCase):\n    def setUp(self):\n        if not hasattr(self, 'table'):\n            self.skipTest('Base class')\n\n    def test_basic(self):\n        xdf, ydf, mdf = self.table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        self.__arreq__(self.table.X, xtable.X)\n        self.__arreq__(self.table.Y, ytable.Y)\n        self.__arreq__(self.table.metas, mtable.metas)\n        self.__arreq__(self.table.W, xtable.W)\n        self.__arreq__(self.table.W, ytable.W)\n        self.__arreq__(self.table.W, mtable.W)\n        self.assertEqual(self.table.attributes, xtable.attributes)\n        self.assertEqual(self.table.attributes, ytable.attributes)\n        self.assertEqual(self.table.attributes, mtable.attributes)\n        self.__arreq__(self.table.ids, xtable.ids)\n        self.__arreq__(self.table.ids, ytable.ids)\n        self.__arreq__(self.table.ids, mtable.ids)\n\n        d1 = self.table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_slice(self):\n        df = self.table.X_df\n        table2 = df[['c2', 'd1']].to_orange_table()\n\n        self.__arreq__(self.table.ids, table2.ids)\n        self.__arreq__(self.table.W, table2.W)\n        self.__arreq__(self.table.attributes, table2.attributes)\n\n        domain = table2.domain\n        target_domain = Domain([ContinuousVariable(\"c2\"),\n                                DiscreteVariable(\"d1\")])\n\n        self.assertEqual(domain, target_domain)\n\n    def test_copy(self):\n        df = self.table.X_df\n        df2 = df.copy()\n\n        np.testing.assert_array_equal(df.index, df2.index)\n        self.assertEqual(df.orange_variables, df2.orange_variables)\n        self.assertEqual(df.orange_role, df2.orange_role)\n        self.assertEqual(df.orange_attributes, df2.orange_attributes)\n        self.assertEqual(df.orange_weights, df2.orange_weights)\n\n    def test_concat_table(self):\n        domain2 = Domain(\n            [self.table.domain['c2'],\n             self.table.domain['d1']]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 0],\n                 [1, 1]]),\n            W=np.array([1, 1])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids,\n                                      np.concatenate([self.table.ids,\n                                                      table2.ids]))\n        np.testing.assert_array_equal(table3.W[:-2],\n                                      self.table.W)\n        np.testing.assert_array_equal(table3.W[-2:],\n                                      table2.W)\n\n        attrs = {}\n        attrs.update(self.table.attributes)\n        attrs.update(table2.attributes)\n\n        self.assertEqual(table3.attributes, attrs)\n\n        vars1 = self.table.domain.variables\n        vars2 = table3.domain.variables\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_concat_df(self):\n        df2 = pd.DataFrame(np.array([[0, 0],\n                                     [1, 1]]))\n\n        df = self.table.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids[:-2],\n                                      self.table.ids)\n\n        d1 = self.table.domain\n        d2 = table3.domain\n\n        vars1 = d1.attributes\n        vars2 = d2.variables + d2.metas\n\n        for v1 in vars1:\n            self.assertIn(v1, vars2)\n\n    def test_merge(self):\n        domain2 = Domain(\n            [ContinuousVariable(\"c2\"),\n             ContinuousVariable(\"d15\")]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 4],\n                 [-1, 15],\n                 [1, 23]])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.merge(df, df2, on='c2')\n        table2 = df.to_orange_table()\n        table3 = df3.to_orange_table()\n\n        self.assertEqual(len(table2), len(table3))\n        self.assertFalse(any(table3.W))\n        self.assertEqual(self.table.attributes, table3.attributes)\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'd15')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_new_column(self):\n        df = self.table.X_df\n        table2 = df.to_orange_table()\n        df['new'] = np.array([0, 1, 0, 1, 6, 1, 1])\n        table3 = df.to_orange_table()\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'new')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_selection(self):\n        df = self.table.X_df\n\n        tsel = self.table[1:3]\n        dfsel = df[1:3].to_orange_table()\n\n        self.__arreq__(tsel.X, dfsel.X)\n        self.__arreq__(tsel.ids, dfsel.ids)\n        self.__arreq__(tsel.W, dfsel.W)\n        self.__arreq__(tsel.attributes, dfsel.attributes)\n\n\nclass TestDenseTablePandas(TestTablePandas):\n    def setUp(self):\n        self.domain = Domain(\n            [ContinuousVariable(\"c1\"),\n             ContinuousVariable(\"c2\"),\n             DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n            ContinuousVariable(\"y\"),\n            [ContinuousVariable(\"c3\"),\n             DiscreteVariable(\"d2\", values=(\"c\", \"d\")),\n             StringVariable(\"s1\"),\n             StringVariable(\"s2\")]\n        )\n        metas = np.array(\n            [0, 1, 0, 1, 1, 2, 1] +\n            [0, 0, 0, 0, 4, 1, 1] +\n            \"a  b  c  d  e     f    g\".split() +\n            list(\"ABCDEF\") + [\"\"], dtype=object).reshape(-1, 7).T\n        self.table = Table.from_numpy(\n            self.domain,\n            np.array(\n                [[0, 0, 0],\n                 [0, -1, 0],\n                 [7, 1, 0],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1]]),\n            np.array(\n                [0, 1, 0, 1, 1, 1, 1]),\n            metas,\n            attributes={'haha': 'hoho'},\n            W=np.array([0, 1, 1, 0, 1, 0, 1])\n        )\n\n        self.__arreq__ = np.testing.assert_equal\n\n    def test_contiguous_x(self):\n        table = self.table\n        df = table.X_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.X))\n        self.assertTrue(np.shares_memory(df.values, table2.X))\n\n    def test_contiguous_y(self):\n        table = self.table\n        df = table.Y_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.Y))\n        self.assertTrue(np.shares_memory(df.values, table2.Y))\n\n    @unittest.skipUnless(pd.__version__ >= '1.3.0',\n                         'pandas-dev/pandas#39263')\n    def test_contiguous_metas(self):\n        table = self.table\n        df = table.metas_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.metas))\n        self.assertTrue(np.shares_memory(df.values, table2.metas))\n\n    def test_to_dfs(self):\n        table = self.table\n        dfs = table.to_pandas_dfs()\n\n        tables = [df.to_orange_table() for df in dfs]\n        for t in tables:\n            arrs = (t.X, t.Y, t.metas)\n            self.assertEqual(sum(\n                arr.size > 0\n                for arr in arrs\n            ), 1)\n\n    def test_amend(self):\n        df = self.table.X_df\n        df.iloc[0][0] = 0\n        X = self.table.X\n        self.table.X_df = df\n        self.assertTrue(np.shares_memory(df.values, X))\n\n    def test_amend_dimension_mismatch(self):\n        df = self.table.X_df\n        df = df.append([0, 1])\n        try:\n            self.table.X_df = df\n        except ValueError as e:\n            self.assertEqual(str(e),\n                             'Leading dimension mismatch (not 7 == 9)')\n        else:\n            self.fail()\n\n\nclass TestSparseTablePandas(TestTablePandas):\n    features = (\n        ContinuousVariable(name=\"c2\"),\n        ContinuousVariable(name=\"Continuous Feature 2\"),\n        DiscreteVariable(name=\"d1\", values=(\"0\", \"1\")),\n        DiscreteVariable(name=\"Discrete Feature 2\",\n                         values=(\"value1\", \"value2\")),\n    )\n\n    class_vars = (\n        ContinuousVariable(name=\"Continuous Class\"),\n        DiscreteVariable(name=\"Discrete Class\", values=(\"m\", \"f\"))\n    )\n\n    feature_data = (\n        (1, 0, 0, 0),\n        (0, 1, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n    )\n\n    class_data = (\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n    )\n\n    def setUp(self):\n        self.domain = Domain(attributes=self.features,\n                             class_vars=self.class_vars)\n        table = Table.from_numpy(\n            self.domain,\n            np.array(self.feature_data),\n            np.array(self.class_data),\n        )\n        self.table = Table.from_numpy(\n            self.domain,\n            csr_matrix(table.X),\n            csr_matrix(table.Y),\n            W=np.array([1, 0, 1, 0, 1, 1, 1])\n        )\n\n        def arreq(t1, t2):\n            if all(sp.issparse(t) for t in (t1, t2)):\n                return self.assertEqual((t1 != t2).nnz, 0)\n            else:\n                return np.array_equal(t1, t2)\n\n        self.__arreq__ = arreq\n\n    def test_to_dense(self):\n        df = self.table.X_df\n\n        self.assertIsInstance(df, OrangeDataFrame)\n\n        ddf = df.sparse.to_dense()\n        np.testing.assert_array_equal(df.index, ddf.index)\n        np.testing.assert_array_equal(df.orange_variables, ddf.orange_variables)\n        np.testing.assert_array_equal(df.orange_attributes, ddf.orange_attributes)\n        np.testing.assert_array_equal(df.orange_role, ddf.orange_role)\n        np.testing.assert_array_equal(df.orange_weights, ddf.orange_weights)\n\n        table = self.table.to_dense()\n        table2 = ddf.to_orange_table()\n\n        np.testing.assert_array_equal(table2.X, table.X)\n        np.testing.assert_array_equal(table2.ids, table.ids)\n        np.testing.assert_array_equal(table2.W, table.W)\n        np.testing.assert_array_equal(table2.attributes, table.attributes)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# pylint: disable=import-outside-toplevel\n\nimport unittest\nimport numpy as np\nfrom scipy.sparse import csr_matrix\nimport scipy.sparse as sp\n\nfrom Orange.data import ContinuousVariable, DiscreteVariable, TimeVariable, Table, Domain, \\\n    StringVariable\nfrom Orange.data.pandas_compat import OrangeDataFrame\n\ntry:\n    import pandas as pd\nexcept ImportError:\n    pd = None\n\n\n@unittest.skipIf(pd is None, \"Missing package 'pandas'\")\nclass TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n        table = table_from_frame(df)\n        self.assertEqual(table.ids[-2:].tolist(), [20, 30])\n        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)\n\n\nclass TestTablePandas(unittest.TestCase):\n    def setUp(self):\n        if not hasattr(self, 'table'):\n            self.skipTest('Base class')\n\n    def test_basic(self):\n        xdf, ydf, mdf = self.table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        self.__arreq__(self.table.X, xtable.X)\n        self.__arreq__(self.table.Y, ytable.Y)\n        self.__arreq__(self.table.metas, mtable.metas)\n        self.__arreq__(self.table.W, xtable.W)\n        self.__arreq__(self.table.W, ytable.W)\n        self.__arreq__(self.table.W, mtable.W)\n        self.assertEqual(self.table.attributes, xtable.attributes)\n        self.assertEqual(self.table.attributes, ytable.attributes)\n        self.assertEqual(self.table.attributes, mtable.attributes)\n        self.__arreq__(self.table.ids, xtable.ids)\n        self.__arreq__(self.table.ids, ytable.ids)\n        self.__arreq__(self.table.ids, mtable.ids)\n\n        d1 = self.table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_slice(self):\n        df = self.table.X_df\n        table2 = df[['c2', 'd1']].to_orange_table()\n\n        self.__arreq__(self.table.ids, table2.ids)\n        self.__arreq__(self.table.W, table2.W)\n        self.__arreq__(self.table.attributes, table2.attributes)\n\n        domain = table2.domain\n        target_domain = Domain([ContinuousVariable(\"c2\"),\n                                DiscreteVariable(\"d1\")])\n\n        self.assertEqual(domain, target_domain)\n\n    def test_copy(self):\n        df = self.table.X_df\n        df2 = df.copy()\n\n        np.testing.assert_array_equal(df.index, df2.index)\n        self.assertEqual(df.orange_variables, df2.orange_variables)\n        self.assertEqual(df.orange_role, df2.orange_role)\n        self.assertEqual(df.orange_attributes, df2.orange_attributes)\n        self.assertEqual(df.orange_weights, df2.orange_weights)\n\n    def test_concat_table(self):\n        domain2 = Domain(\n            [self.table.domain['c2'],\n             self.table.domain['d1']]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 0],\n                 [1, 1]]),\n            W=np.array([1, 1])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids,\n                                      np.concatenate([self.table.ids,\n                                                      table2.ids]))\n        np.testing.assert_array_equal(table3.W[:-2],\n                                      self.table.W)\n        np.testing.assert_array_equal(table3.W[-2:],\n                                      table2.W)\n\n        attrs = {}\n        attrs.update(self.table.attributes)\n        attrs.update(table2.attributes)\n\n        self.assertEqual(table3.attributes, attrs)\n\n        vars1 = self.table.domain.variables\n        vars2 = table3.domain.variables\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_concat_df(self):\n        df2 = pd.DataFrame(np.array([[0, 0],\n                                     [1, 1]]))\n\n        df = self.table.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids[:-2],\n                                      self.table.ids)\n\n        d1 = self.table.domain\n        d2 = table3.domain\n\n        vars1 = d1.attributes\n        vars2 = d2.variables + d2.metas\n\n        for v1 in vars1:\n            self.assertIn(v1, vars2)\n\n    def test_merge(self):\n        domain2 = Domain(\n            [ContinuousVariable(\"c2\"),\n             ContinuousVariable(\"d15\")]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 4],\n                 [-1, 15],\n                 [1, 23]])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.merge(df, df2, on='c2')\n        table2 = df.to_orange_table()\n        table3 = df3.to_orange_table()\n\n        self.assertEqual(len(table2), len(table3))\n        self.assertFalse(any(table3.W))\n        self.assertEqual(self.table.attributes, table3.attributes)\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'd15')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_new_column(self):\n        df = self.table.X_df\n        table2 = df.to_orange_table()\n        df['new'] = np.array([0, 1, 0, 1, 6, 1, 1])\n        table3 = df.to_orange_table()\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'new')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_selection(self):\n        df = self.table.X_df\n\n        tsel = self.table[1:3]\n        dfsel = df[1:3].to_orange_table()\n\n        self.__arreq__(tsel.X, dfsel.X)\n        self.__arreq__(tsel.ids, dfsel.ids)\n        self.__arreq__(tsel.W, dfsel.W)\n        self.__arreq__(tsel.attributes, dfsel.attributes)\n\n\nclass TestDenseTablePandas(TestTablePandas):\n    def setUp(self):\n        self.domain = Domain(\n            [ContinuousVariable(\"c1\"),\n             ContinuousVariable(\"c2\"),\n             DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n            ContinuousVariable(\"y\"),\n            [ContinuousVariable(\"c3\"),\n             DiscreteVariable(\"d2\", values=(\"c\", \"d\")),\n             StringVariable(\"s1\"),\n             StringVariable(\"s2\")]\n        )\n        metas = np.array(\n            [0, 1, 0, 1, 1, 2, 1] +\n            [0, 0, 0, 0, 4, 1, 1] +\n            \"a  b  c  d  e     f    g\".split() +\n            list(\"ABCDEF\") + [\"\"], dtype=object).reshape(-1, 7).T\n        self.table = Table.from_numpy(\n            self.domain,\n            np.array(\n                [[0, 0, 0],\n                 [0, -1, 0],\n                 [7, 1, 0],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1]]),\n            np.array(\n                [0, 1, 0, 1, 1, 1, 1]),\n            metas,\n            attributes={'haha': 'hoho'},\n            W=np.array([0, 1, 1, 0, 1, 0, 1])\n        )\n\n        self.__arreq__ = np.testing.assert_equal\n\n    def test_contiguous_x(self):\n        table = self.table\n        df = table.X_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.X))\n        self.assertTrue(np.shares_memory(df.values, table2.X))\n\n    def test_contiguous_y(self):\n        table = self.table\n        df = table.Y_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.Y))\n        self.assertTrue(np.shares_memory(df.values, table2.Y))\n\n    @unittest.skipUnless(pd.__version__ >= '1.3.0',\n                         'pandas-dev/pandas#39263')\n    def test_contiguous_metas(self):\n        table = self.table\n        df = table.metas_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.metas))\n        self.assertTrue(np.shares_memory(df.values, table2.metas))\n\n    def test_to_dfs(self):\n        table = self.table\n        dfs = table.to_pandas_dfs()\n\n        tables = [df.to_orange_table() for df in dfs]\n        for t in tables:\n            arrs = (t.X, t.Y, t.metas)\n            self.assertEqual(sum(\n                arr.size > 0\n                for arr in arrs\n            ), 1)\n\n    def test_amend(self):\n        df = self.table.X_df\n        df.iloc[0][0] = 0\n        X = self.table.X\n        self.table.X_df = df\n        self.assertTrue(np.shares_memory(df.values, X))\n\n    def test_amend_dimension_mismatch(self):\n        df = self.table.X_df\n        df = df.append([0, 1])\n        try:\n            self.table.X_df = df\n        except ValueError as e:\n            self.assertEqual(str(e),\n                             'Leading dimension mismatch (not 7 == 9)')\n        else:\n            self.fail()\n\n\nclass TestSparseTablePandas(TestTablePandas):\n    features = (\n        ContinuousVariable(name=\"c2\"),\n        ContinuousVariable(name=\"Continuous Feature 2\"),\n        DiscreteVariable(name=\"d1\", values=(\"0\", \"1\")),\n        DiscreteVariable(name=\"Discrete Feature 2\",\n                         values=(\"value1\", \"value2\")),\n    )\n\n    class_vars = (\n        ContinuousVariable(name=\"Continuous Class\"),\n        DiscreteVariable(name=\"Discrete Class\", values=(\"m\", \"f\"))\n    )\n\n    feature_data = (\n        (1, 0, 0, 0),\n        (0, 1, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n    )\n\n    class_data = (\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n    )\n\n    def setUp(self):\n        self.domain = Domain(attributes=self.features,\n                             class_vars=self.class_vars)\n        table = Table.from_numpy(\n            self.domain,\n            np.array(self.feature_data),\n            np.array(self.class_data),\n        )\n        self.table = Table.from_numpy(\n            self.domain,\n            csr_matrix(table.X),\n            csr_matrix(table.Y),\n            W=np.array([1, 0, 1, 0, 1, 1, 1])\n        )\n\n        def arreq(t1, t2):\n            if all(sp.issparse(t) for t in (t1, t2)):\n                return self.assertEqual((t1 != t2).nnz, 0)\n            else:\n                return np.array_equal(t1, t2)\n\n        self.__arreq__ = arreq\n\n    def test_to_dense(self):\n        df = self.table.X_df\n\n        self.assertIsInstance(df, OrangeDataFrame)\n\n        ddf = df.sparse.to_dense()\n        np.testing.assert_array_equal(df.index, ddf.index)\n        np.testing.assert_array_equal(df.orange_variables, ddf.orange_variables)\n        np.testing.assert_array_equal(df.orange_attributes, ddf.orange_attributes)\n        np.testing.assert_array_equal(df.orange_role, ddf.orange_role)\n        np.testing.assert_array_equal(df.orange_weights, ddf.orange_weights)\n\n        table = self.table.to_dense()\n        table2 = ddf.to_orange_table()\n\n        np.testing.assert_array_equal(table2.X, table.X)\n        np.testing.assert_array_equal(table2.ids, table.ids)\n        np.testing.assert_array_equal(table2.W, table.W)\n        np.testing.assert_array_equal(table2.attributes, table.attributes)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/data/tests/test_pandas.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "6182c7023",
                "new_commit_hash": "5a854c444",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/tests/test_pandas.py"
            },
            "plus_file": {
                "path": "b/Orange/data/tests/test_pandas.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 69,
                            "length": 6
                        },
                        "new_range": {
                            "start": 69,
                            "length": 15
                        },
                        "section": "class TestPandasCompat(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual(names, ['index', '1', '2'])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_table_from_frame_keep_ids(self):",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\" Test if indices are correctly transferred to Table\"\"\"",
                                "type": "added"
                            },
                            {
                                "content": "        from Orange.data.pandas_compat import table_from_frame",
                                "type": "added"
                            },
                            {
                                "content": "        df = OrangeDataFrame(Table('iris')[:6])",
                                "type": "added"
                            },
                            {
                                "content": "        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]",
                                "type": "added"
                            },
                            {
                                "content": "        table = table_from_frame(df)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(table.ids[-2:].tolist(), [20, 30])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_table_to_frame(self):",
                                "type": "context"
                            },
                            {
                                "content": "        from Orange.data.pandas_compat import table_to_frame",
                                "type": "context"
                            },
                            {
                                "content": "        table = Table(\"iris\")",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/tests/test_pandas.py",
                            "type": "class",
                            "name": "TestPandasCompat",
                            "content": "class TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n        table = table_from_frame(df)\n        self.assertEqual(table.ids[-2:].tolist(), [20, 30])\n        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 19,
                            "end_lineno": 176,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/tests/test_pandas.py",
                            "type": "method",
                            "name": "TestPandasCompat.test_table_from_frame_keep_ids",
                            "content": "class TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n        table = table_from_frame(df)\n        self.assertEqual(table.ids[-2:].tolist(), [20, 30])\n        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 72,
                            "end_lineno": 79,
                            "parent": {
                                "file_name": "Orange/data/tests/test_pandas.py",
                                "type": "class",
                                "name": "TestPandasCompat",
                                "content": "class TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n        table = table_from_frame(df)\n        self.assertEqual(table.ids[-2:].tolist(), [20, 30])\n        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 19,
                                "end_lineno": 176,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "65b195a8a1f18858c0412407782dbaa48a1f6795^",
    "new_commit_hash": "65b195a8a1f18858c0412407782dbaa48a1f6795",
    "commit_message": "table_from_frame - speedups",
    "commit_date": "2021-06-04T17:36:16+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "65b195a8a1f18858c0412407782dbaa48a1f6795",
    "test_file_codes": [
        "# pylint: disable=import-outside-toplevel\n\nimport unittest\nimport numpy as np\nfrom scipy.sparse import csr_matrix\nimport scipy.sparse as sp\n\nfrom Orange.data import ContinuousVariable, DiscreteVariable, TimeVariable, Table, Domain, \\\n    StringVariable\nfrom Orange.data.pandas_compat import OrangeDataFrame\n\ntry:\n    import pandas as pd\nexcept ImportError:\n    pd = None\n\n\n@unittest.skipIf(pd is None, \"Missing package 'pandas'\")\nclass TestPandasCompat(unittest.TestCase):\n    def test_table_from_frame(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        nan = np.nan\n        df = pd.DataFrame([['a', 1, pd.Timestamp('2017-12-19')],\n                           ['b', 0, pd.Timestamp('1724-12-20')],\n                           ['c', 0, pd.Timestamp('1724-12-20')],\n                           [nan, nan, nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['1', '2'])\n        self.assertEqual(types, [ContinuousVariable, TimeVariable])\n\n        # Force strings nominal\n        table = table_from_frame(df, force_nominal=True)\n        np.testing.assert_equal(table.X, [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                          [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [2, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                          [nan, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [[], [], [], []])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['0', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n        # Include index\n        df.index = list('abaa')\n        table = table_from_frame(df)\n        np.testing.assert_equal(table.X,\n                                [[0, 1, pd.Timestamp('2017-12-19').timestamp()],\n                                 [1, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, 0, pd.Timestamp('1724-12-20').timestamp()],\n                                 [0, nan, nan]])\n        np.testing.assert_equal(table.metas.tolist(), [['a'],\n                                                       ['b'],\n                                                       ['c'],\n                                                       [nan]])\n        names = [var.name for var in table.domain.attributes]\n        types = [type(var) for var in table.domain.attributes]\n        self.assertEqual(names, ['index', '1', '2'])\n        self.assertEqual(types, [DiscreteVariable, ContinuousVariable, TimeVariable])\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n        table = table_from_frame(df)\n        self.assertEqual(table.ids[-2:].tolist(), [20, 30])\n        self.assertTrue(np.issubdtype(table.ids.dtype, np.number))\n\n    def test_table_to_frame(self):\n        from Orange.data.pandas_compat import table_to_frame\n        table = Table(\"iris\")\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(type(df['iris'].dtype), pd.api.types.CategoricalDtype)\n        self.assertEqual(list(df['sepal length'])[0:4], [5.1, 4.9, 4.7, 4.6])\n        self.assertEqual(list(df['iris'])[0:2], ['Iris-setosa', 'Iris-setosa'])\n\n    def test_table_to_frame_nans(self):\n        from Orange.data.pandas_compat import table_to_frame\n        domain = Domain(\n            [ContinuousVariable(\"a\", number_of_decimals=0), ContinuousVariable(\"b\")]\n        )\n        table = Table(\n            domain, np.column_stack((np.ones(10), np.hstack((np.ones(9), [np.nan]))))\n        )\n\n        df = table_to_frame(table)\n        table_column_names = [var.name for var in table.domain.variables]\n        frame_column_names = df.columns\n\n        self.assertEqual(sorted(table_column_names), sorted(frame_column_names))\n        self.assertEqual(df[\"a\"].dtype, int)\n        self.assertEqual(df[\"b\"].dtype, float)\n        self.assertEqual([1, 1, 1], list(df[\"a\"].iloc[-3:]))\n        self.assertTrue(np.isnan(df[\"b\"].iloc[-1]))\n\n    def test_table_to_frame_metas(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        table = Table(\"zoo\")\n        domain = table.domain\n\n        df = table_to_frame(table)\n        cols = pd.Index([var.name for var in domain.variables])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n        df = table_to_frame(table, include_metas=True)\n        cols = pd.Index([var.name for var in domain.variables + domain.metas])\n        pd.testing.assert_index_equal(df.columns, cols)\n\n    def test_not_orangedf(self):\n        table = Table(\"iris\")\n        xdf, ydf, mdf = table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        np.testing.assert_array_equal(table.X, xtable.X)\n        np.testing.assert_array_equal(table.Y, ytable.Y)\n        np.testing.assert_array_equal(table.metas, mtable.metas)\n        np.testing.assert_array_equal(table.W, xtable.W)\n        np.testing.assert_array_equal(table.W, ytable.W)\n        np.testing.assert_array_equal(table.W, mtable.W)\n        self.assertEqual(table.attributes, xtable.attributes)\n        self.assertEqual(table.attributes, ytable.attributes)\n        self.assertEqual(table.attributes, mtable.attributes)\n        np.testing.assert_array_equal(table.ids, xtable.ids)\n        np.testing.assert_array_equal(table.ids, ytable.ids)\n        np.testing.assert_array_equal(table.ids, mtable.ids)\n\n        d1 = table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    @unittest.skip(\"Convert all Orange demo dataset. It takes about 5s which is way to slow\")\n    def test_table_to_frame_on_all_orange_dataset(self):\n        from os import listdir\n        from Orange.data.pandas_compat import table_to_frame\n\n        dataset_directory = \"Orange/datasets/\"\n\n        def _filename_to_dataset_name(f):\n            return f.split('.')[0]\n\n        def _get_orange_demo_datasets():\n            x = [_filename_to_dataset_name(f) for f in listdir(dataset_directory) if '.tab' in f]\n            return x\n\n        for name in _get_orange_demo_datasets():\n            table = Table(name)\n            df = table_to_frame(table)\n            assert_message = \"Failed to process Table('{}')\".format(name)\n\n            self.assertEqual(type(df), pd.DataFrame, assert_message)\n            self.assertEqual(len(df), len(table), assert_message)\n            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)\n\n\nclass TestTablePandas(unittest.TestCase):\n    def setUp(self):\n        if not hasattr(self, 'table'):\n            self.skipTest('Base class')\n\n    def test_basic(self):\n        xdf, ydf, mdf = self.table.to_pandas_dfs()\n        xtable = xdf.to_orange_table()\n        ytable = ydf.to_orange_table()\n        mtable = mdf.to_orange_table()\n\n        self.__arreq__(self.table.X, xtable.X)\n        self.__arreq__(self.table.Y, ytable.Y)\n        self.__arreq__(self.table.metas, mtable.metas)\n        self.__arreq__(self.table.W, xtable.W)\n        self.__arreq__(self.table.W, ytable.W)\n        self.__arreq__(self.table.W, mtable.W)\n        self.assertEqual(self.table.attributes, xtable.attributes)\n        self.assertEqual(self.table.attributes, ytable.attributes)\n        self.assertEqual(self.table.attributes, mtable.attributes)\n        self.__arreq__(self.table.ids, xtable.ids)\n        self.__arreq__(self.table.ids, ytable.ids)\n        self.__arreq__(self.table.ids, mtable.ids)\n\n        d1 = self.table.domain\n        d2 = xtable.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_slice(self):\n        df = self.table.X_df\n        table2 = df[['c2', 'd1']].to_orange_table()\n\n        self.__arreq__(self.table.ids, table2.ids)\n        self.__arreq__(self.table.W, table2.W)\n        self.__arreq__(self.table.attributes, table2.attributes)\n\n        domain = table2.domain\n        target_domain = Domain([ContinuousVariable(\"c2\"),\n                                DiscreteVariable(\"d1\")])\n\n        self.assertEqual(domain, target_domain)\n\n    def test_copy(self):\n        df = self.table.X_df\n        df2 = df.copy()\n\n        np.testing.assert_array_equal(df.index, df2.index)\n        self.assertEqual(df.orange_variables, df2.orange_variables)\n        self.assertEqual(df.orange_role, df2.orange_role)\n        self.assertEqual(df.orange_attributes, df2.orange_attributes)\n        self.assertEqual(df.orange_weights, df2.orange_weights)\n\n    def test_concat_table(self):\n        domain2 = Domain(\n            [self.table.domain['c2'],\n             self.table.domain['d1']]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 0],\n                 [1, 1]]),\n            W=np.array([1, 1])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids,\n                                      np.concatenate([self.table.ids,\n                                                      table2.ids]))\n        np.testing.assert_array_equal(table3.W[:-2],\n                                      self.table.W)\n        np.testing.assert_array_equal(table3.W[-2:],\n                                      table2.W)\n\n        attrs = {}\n        attrs.update(self.table.attributes)\n        attrs.update(table2.attributes)\n\n        self.assertEqual(table3.attributes, attrs)\n\n        vars1 = self.table.domain.variables\n        vars2 = table3.domain.variables\n\n        for v1, v2 in zip(vars1, vars2):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_concat_df(self):\n        df2 = pd.DataFrame(np.array([[0, 0],\n                                     [1, 1]]))\n\n        df = self.table.X_df\n        df3 = pd.concat([df, df2])\n        table3 = df3.to_orange_table()\n\n        np.testing.assert_array_equal(table3.ids[:-2],\n                                      self.table.ids)\n\n        d1 = self.table.domain\n        d2 = table3.domain\n\n        vars1 = d1.attributes\n        vars2 = d2.variables + d2.metas\n\n        for v1 in vars1:\n            self.assertIn(v1, vars2)\n\n    def test_merge(self):\n        domain2 = Domain(\n            [ContinuousVariable(\"c2\"),\n             ContinuousVariable(\"d15\")]\n        )\n        table2 = Table.from_numpy(\n            domain2,\n            np.array(\n                [[0, 4],\n                 [-1, 15],\n                 [1, 23]])\n        )\n\n        df = self.table.X_df\n        df2 = table2.X_df\n        df3 = pd.merge(df, df2, on='c2')\n        table2 = df.to_orange_table()\n        table3 = df3.to_orange_table()\n\n        self.assertEqual(len(table2), len(table3))\n        self.assertFalse(any(table3.W))\n        self.assertEqual(self.table.attributes, table3.attributes)\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'd15')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_new_column(self):\n        df = self.table.X_df\n        table2 = df.to_orange_table()\n        df['new'] = np.array([0, 1, 0, 1, 6, 1, 1])\n        table3 = df.to_orange_table()\n\n        d1 = table2.domain\n        d2 = table3.domain\n\n        vars1 = d1.variables + d1.metas\n        vars2 = d2.variables + d2.metas\n\n        self.assertEqual(len(vars2), len(vars1) + 1)\n\n        new_var = next(v for v in vars2\n                       if v.name == 'new')\n        self.assertIsInstance(new_var, ContinuousVariable)\n\n        new_var_excluded = [v for v in vars2\n                            if v != new_var]\n        for v1, v2 in zip(vars1, new_var_excluded):\n            self.assertEqual(type(v1), type(v2))\n\n    def test_selection(self):\n        df = self.table.X_df\n\n        tsel = self.table[1:3]\n        dfsel = df[1:3].to_orange_table()\n\n        self.__arreq__(tsel.X, dfsel.X)\n        self.__arreq__(tsel.ids, dfsel.ids)\n        self.__arreq__(tsel.W, dfsel.W)\n        self.__arreq__(tsel.attributes, dfsel.attributes)\n\n\nclass TestDenseTablePandas(TestTablePandas):\n    def setUp(self):\n        self.domain = Domain(\n            [ContinuousVariable(\"c1\"),\n             ContinuousVariable(\"c2\"),\n             DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n            ContinuousVariable(\"y\"),\n            [ContinuousVariable(\"c3\"),\n             DiscreteVariable(\"d2\", values=(\"c\", \"d\")),\n             StringVariable(\"s1\"),\n             StringVariable(\"s2\")]\n        )\n        metas = np.array(\n            [0, 1, 0, 1, 1, 2, 1] +\n            [0, 0, 0, 0, 4, 1, 1] +\n            \"a  b  c  d  e     f    g\".split() +\n            list(\"ABCDEF\") + [\"\"], dtype=object).reshape(-1, 7).T\n        self.table = Table.from_numpy(\n            self.domain,\n            np.array(\n                [[0, 0, 0],\n                 [0, -1, 0],\n                 [7, 1, 0],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1],\n                 [1, 1, 1]]),\n            np.array(\n                [0, 1, 0, 1, 1, 1, 1]),\n            metas,\n            attributes={'haha': 'hoho'},\n            W=np.array([0, 1, 1, 0, 1, 0, 1])\n        )\n\n        self.__arreq__ = np.testing.assert_equal\n\n    def test_contiguous_x(self):\n        table = self.table\n        df = table.X_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.X))\n        self.assertTrue(np.shares_memory(df.values, table2.X))\n\n    def test_contiguous_y(self):\n        table = self.table\n        df = table.Y_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.Y))\n        self.assertTrue(np.shares_memory(df.values, table2.Y))\n\n    @unittest.skipUnless(pd.__version__ >= '1.3.0',\n                         'pandas-dev/pandas#39263')\n    def test_contiguous_metas(self):\n        table = self.table\n        df = table.metas_df\n        table2 = df.to_orange_table()\n        self.assertTrue(np.shares_memory(df.values, table.metas))\n        self.assertTrue(np.shares_memory(df.values, table2.metas))\n\n    def test_to_dfs(self):\n        table = self.table\n        dfs = table.to_pandas_dfs()\n\n        tables = [df.to_orange_table() for df in dfs]\n        for t in tables:\n            arrs = (t.X, t.Y, t.metas)\n            self.assertEqual(sum(\n                arr.size > 0\n                for arr in arrs\n            ), 1)\n\n    def test_amend(self):\n        df = self.table.X_df\n        df.iloc[0][0] = 0\n        X = self.table.X\n        self.table.X_df = df\n        self.assertTrue(np.shares_memory(df.values, X))\n\n    def test_amend_dimension_mismatch(self):\n        df = self.table.X_df\n        df = df.append([0, 1])\n        try:\n            self.table.X_df = df\n        except ValueError as e:\n            self.assertEqual(str(e),\n                             'Leading dimension mismatch (not 7 == 9)')\n        else:\n            self.fail()\n\n\nclass TestSparseTablePandas(TestTablePandas):\n    features = (\n        ContinuousVariable(name=\"c2\"),\n        ContinuousVariable(name=\"Continuous Feature 2\"),\n        DiscreteVariable(name=\"d1\", values=(\"0\", \"1\")),\n        DiscreteVariable(name=\"Discrete Feature 2\",\n                         values=(\"value1\", \"value2\")),\n    )\n\n    class_vars = (\n        ContinuousVariable(name=\"Continuous Class\"),\n        DiscreteVariable(name=\"Discrete Class\", values=(\"m\", \"f\"))\n    )\n\n    feature_data = (\n        (1, 0, 0, 0),\n        (0, 1, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n        (0, 0, 0, 0),\n        (0, 1, 1, 0),\n    )\n\n    class_data = (\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n        (0, 1),\n        (1, 0),\n    )\n\n    def setUp(self):\n        self.domain = Domain(attributes=self.features,\n                             class_vars=self.class_vars)\n        table = Table.from_numpy(\n            self.domain,\n            np.array(self.feature_data),\n            np.array(self.class_data),\n        )\n        self.table = Table.from_numpy(\n            self.domain,\n            csr_matrix(table.X),\n            csr_matrix(table.Y),\n            W=np.array([1, 0, 1, 0, 1, 1, 1])\n        )\n\n        def arreq(t1, t2):\n            if all(sp.issparse(t) for t in (t1, t2)):\n                return self.assertEqual((t1 != t2).nnz, 0)\n            else:\n                return np.array_equal(t1, t2)\n\n        self.__arreq__ = arreq\n\n    def test_to_dense(self):\n        df = self.table.X_df\n\n        self.assertIsInstance(df, OrangeDataFrame)\n\n        ddf = df.sparse.to_dense()\n        np.testing.assert_array_equal(df.index, ddf.index)\n        np.testing.assert_array_equal(df.orange_variables, ddf.orange_variables)\n        np.testing.assert_array_equal(df.orange_attributes, ddf.orange_attributes)\n        np.testing.assert_array_equal(df.orange_role, ddf.orange_role)\n        np.testing.assert_array_equal(df.orange_weights, ddf.orange_weights)\n\n        table = self.table.to_dense()\n        table2 = ddf.to_orange_table()\n\n        np.testing.assert_array_equal(table2.X, table.X)\n        np.testing.assert_array_equal(table2.ids, table.ids)\n        np.testing.assert_array_equal(table2.W, table.W)\n        np.testing.assert_array_equal(table2.attributes, table.attributes)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build\ncreating build/temp.linux-x86_64-3.7\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o\ncreating build/lib.linux-x86_64-3.7\ncreating build/lib.linux-x86_64-3.7/Orange\ncreating build/lib.linux-x86_64-3.7/Orange/classification\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_contingency.c -o build/temp.linux-x86_64-3.7/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-3.7/Orange/data\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_io.c -o build/temp.linux-x86_64-3.7/Orange/data/_io.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_variable.c -o build/temp.linux-x86_64-3.7/Orange/data/_variable.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/distance/_distance.c -o build/temp.linux-x86_64-3.7/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-3.7/Orange/distance\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/projection/_som.c -o build/temp.linux-x86_64-3.7/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-3.7/Orange/projection\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._simple_tree' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-3.7/Orange/widgets\ncreating build/lib.linux-x86_64-3.7/Orange/widgets/utils\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nrunning develop\nrunning egg_info\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.30.0.dev0+65b195a to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795\nProcessing dependencies for Orange3==3.30.0.dev0+65b195a\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for httpx==0.16.1\nBest match: httpx 0.16.1\nAdding httpx 0.16.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.12.3\nBest match: httpcore 0.12.3\nAdding httpcore 0.12.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.30.0.dev0+65b195a\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 177ms\nPrepared 18 packages in 2ms\nInstalled 18 packages in 159ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 53 packages in 367ms\nInstalled 47 packages in 1.07s\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.14.0\n + httpcore==0.12.3\n + httpx==0.16.1\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 55ms\nInstalled 13 packages in 76ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 4ms\nInstalled 2 packages in 120ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 36ms\nInstalled 5 packages in 1.18s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 3ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3413:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3413 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4869:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4869 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5615:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5615 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5736:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5736 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5742:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5742 |           __pyx_t_20 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7202:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7202 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7857:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7857 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7917:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7917 |               __pyx_t_15 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:4120:43: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4120 |           __pyx_v_value = ((__pyx_v_value * __pyx_v_decs) + (__pyx_v_c & 0xf));\n      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/data/_io.c:4318:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4318 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:683:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  683 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1590:7: note: ‘__pyx_v_attr_index’ was declared here\n 1590 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:3183:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3183 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:774:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:790:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:3863:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3863 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3862:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3862 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:4934:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4934 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4933:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4933 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4732:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4732 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4307:7: note: ‘__pyx_v_win_y’ was declared here\n 4307 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4721:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4721 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4306:7: note: ‘__pyx_v_win_x’ was declared here\n 4306 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:5682:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5682 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5681:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5681 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:3184:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3184 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2887:7: note: ‘__pyx_v_win_y’ was declared here\n 2887 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3173:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3173 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2886:7: note: ‘__pyx_v_win_x’ was declared here\n 2886 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3357:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3357 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795\ncollected 38 items\n\nr2e_tests/test_1.py ......sssssssss.....F.................               [100%]\n\n=================================== FAILURES ===================================\n__________________ TestDenseTablePandas.test_contiguous_metas __________________\n\nself = <r2e_tests.test_1.TestDenseTablePandas testMethod=test_contiguous_metas>\n\n    @unittest.skipUnless(pd.__version__ >= '1.3.0',\n                         'pandas-dev/pandas#39263')\n    def test_contiguous_metas(self):\n        table = self.table\n        df = table.metas_df\n        table2 = df.to_orange_table()\n>       self.assertTrue(np.shares_memory(df.values, table.metas))\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:425: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_not_orangedf\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_keep_ids\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame_metas\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame_nans\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_amend\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_amend_dimension_mismatch\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_basic\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_concat_df\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_concat_table\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_x\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_y\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_copy\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_merge\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_new_column\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_selection\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_slice\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_to_dfs\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_basic\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_concat_df\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_concat_table\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_copy\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_merge\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_new_column\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_selection\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_slice\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_to_dense\nSKIPPED [1] r2e_tests/test_1.py:155: Convert all Orange demo dataset. It takes about 5s which is way to slow\nSKIPPED [1] r2e_tests/test_1.py:184: Base class\nSKIPPED [1] r2e_tests/test_1.py:274: Base class\nSKIPPED [1] r2e_tests/test_1.py:236: Base class\nSKIPPED [1] r2e_tests/test_1.py:226: Base class\nSKIPPED [1] r2e_tests/test_1.py:294: Base class\nSKIPPED [1] r2e_tests/test_1.py:334: Base class\nSKIPPED [1] r2e_tests/test_1.py:357: Base class\nSKIPPED [1] r2e_tests/test_1.py:212: Base class\nFAILED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_metas - Ass...\n=================== 1 failed, 28 passed, 9 skipped in 2.36s ====================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_65b195a8a1f18858c0412407782dbaa48a1f6795\ncollected 38 items\n\nr2e_tests/test_1.py ..F...sssssssss.....F.................               [100%]\n\n=================================== FAILURES ===================================\n_______________ TestPandasCompat.test_table_from_frame_keep_ids ________________\n\nself = <r2e_tests.test_1.TestPandasCompat testMethod=test_table_from_frame_keep_ids>\n\n    def test_table_from_frame_keep_ids(self):\n        \"\"\" Test if indices are correctly transferred to Table\"\"\"\n        from Orange.data.pandas_compat import table_from_frame\n        df = OrangeDataFrame(Table('iris')[:6])\n        df.index = [1, \"_oa\", \"_o\", \"1\", \"_o20\", \"_o30\"]\n>       table = table_from_frame(df)\n\nr2e_tests/test_1.py:77: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nOrange/data/pandas_compat.py:290: in table_from_frame\n    for i in df.index]\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n.0 = <map object at 0x7b561dbabf90>\n\n    ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()\n>          for i in df.index]\nE   ValueError: invalid literal for int() with base 10: 'a'\n\nOrange/data/pandas_compat.py:290: ValueError\n__________________ TestDenseTablePandas.test_contiguous_metas __________________\n\nself = <r2e_tests.test_1.TestDenseTablePandas testMethod=test_contiguous_metas>\n\n    @unittest.skipUnless(pd.__version__ >= '1.3.0',\n                         'pandas-dev/pandas#39263')\n    def test_contiguous_metas(self):\n        table = self.table\n        df = table.metas_df\n        table2 = df.to_orange_table()\n>       self.assertTrue(np.shares_memory(df.values, table.metas))\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:425: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_not_orangedf\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame_metas\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_to_frame_nans\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_amend\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_amend_dimension_mismatch\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_basic\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_concat_df\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_concat_table\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_x\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_y\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_copy\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_merge\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_new_column\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_selection\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_slice\nPASSED r2e_tests/test_1.py::TestDenseTablePandas::test_to_dfs\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_basic\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_concat_df\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_concat_table\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_copy\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_merge\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_new_column\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_selection\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_slice\nPASSED r2e_tests/test_1.py::TestSparseTablePandas::test_to_dense\nSKIPPED [1] r2e_tests/test_1.py:155: Convert all Orange demo dataset. It takes about 5s which is way to slow\nSKIPPED [1] r2e_tests/test_1.py:184: Base class\nSKIPPED [1] r2e_tests/test_1.py:274: Base class\nSKIPPED [1] r2e_tests/test_1.py:236: Base class\nSKIPPED [1] r2e_tests/test_1.py:226: Base class\nSKIPPED [1] r2e_tests/test_1.py:294: Base class\nSKIPPED [1] r2e_tests/test_1.py:334: Base class\nSKIPPED [1] r2e_tests/test_1.py:357: Base class\nSKIPPED [1] r2e_tests/test_1.py:212: Base class\nFAILED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_keep_ids\nFAILED r2e_tests/test_1.py::TestDenseTablePandas::test_contiguous_metas - Ass...\n=================== 2 failed, 27 passed, 9 skipped in 1.78s ====================\n",
    "old_commit_res_stderr": ""
}
Orange/data/pandas_compat.py Orange/data/tests/test_pandas.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** `table_from_frame` Raises ValueError with Non-Integer String Indices

**Description:**
When converting a pandas DataFrame to an Orange Table using `table_from_frame`, the function fails if the DataFrame's index contains non-integer strings. This issue arises because the function attempts to convert parts of the index to integers without handling cases where the conversion isn't possible.

**Example Buggy Code:**
```python
from Orange.data.pandas_compat import table_from_frame
from Orange.data import Table
import pandas as pd

# Create a DataFrame with mixed index types
df = pd.DataFrame({
    'feature': [1, 2, 3, 4, 5, 6],
    'target': ['a', 'b', 'c', 'd', 'e', 'f']
})
df.index = [1, "_oa", "_o", "1", "_o20", "_o30"]

# Attempt to convert to Orange Table
table = table_from_frame(df)
```

**Expected Behavior:**
The function should correctly handle indices with the `_o` prefix by extracting the numeric part where applicable and assigning appropriate IDs. Indices that do not follow the expected format should be handled gracefully, possibly by assigning new unique IDs without raising errors.

**Actual Behavior:**
A `ValueError` is raised with the message:
```
ValueError: invalid literal for int() with base 10: 'a'
```
This error occurs because the function attempts to convert parts of the index that are not purely numeric, leading to a failure when encountering unexpected string values.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/data/pandas_compat.py
"""Pandas DataFrame↔Table conversion helpers"""
from unittest.mock import patch

import numpy as np
from scipy import sparse as sp
from scipy.sparse import csr_matrix
import pandas as pd
from pandas.core.arrays import SparseArray
from pandas.core.arrays.sparse.dtype import SparseDtype
from pandas.api.types import (
    is_categorical_dtype, is_object_dtype,
    is_datetime64_any_dtype, is_numeric_dtype, is_integer_dtype
)

from Orange.data import (
    Table, Domain, DiscreteVariable, StringVariable, TimeVariable,
    ContinuousVariable,
)
from Orange.data.table import Role

__all__ = ['table_from_frame', 'table_to_frame']


class OrangeDataFrame(pd.DataFrame):
    _metadata = ["orange_variables", "orange_weights",
                 "orange_attributes", "orange_role"]

    def __init__(self, *args, **kwargs):
        """
        A pandas DataFrame wrapper for one of Table's numpy arrays:
            - sets index values corresponding to Orange's global row indices
              e.g. ['_o1', '_o2'] (allows Orange to handle selection)
            - remembers the array's role in the Table (attribute, class var, meta)
            - keeps the Variable objects, and uses them in back-to-table conversion,
              should a column name match a variable's name
            - stores weight values (legacy)

        Parameters
        ----------
        table : Table
        orange_role : Role, (default=Role.Attribute)
            When converting back to an orange table, the DataFrame will
            convert to the right role (attrs, class vars, or metas)
        """
        if len(args) <= 0 or not isinstance(args[0], Table):
            super().__init__(*args, **kwargs)
            return
        table = args[0]
        if 'orange_role' in kwargs:
            role = kwargs.pop('orange_role')
        elif len(args) >= 2:
            role = args[1]
        else:
            role = Role.Attribute

        if role == Role.Attribute:
            data = table.X
            vars_ = table.domain.attributes
        elif role == Role.ClassAttribute:
            data = table.Y
            vars_ = table.domain.class_vars
        else:  # if role == Role.Meta:
            data = table.metas
            vars_ = table.domain.metas

        index = ['_o' + str(id_) for id_ in table.ids]
        varsdict = {var._name: var for var in vars_}
        columns = varsdict.keys()

        if sp.issparse(data):
            data = data.asformat('csc')
            sparrays = [SparseArray.from_spmatrix(data[:, i]) for i in range(data.shape[1])]
            data = dict(enumerate(sparrays))
            super().__init__(data, index=index, **kwargs)
            self.columns = columns
            # a hack to keep Orange df _metadata in sparse->dense conversion
            self.sparse.to_dense = self.__patch_constructor(self.sparse.to_dense)
        else:
            super().__init__(data=data, index=index, columns=columns, **kwargs)

        self.orange_role = role
        self.orange_variables = varsdict
        self.orange_weights = (dict(zip(index, table.W))
                               if table.W.size > 0 else {})
        self.orange_attributes = table.attributes

    def __patch_constructor(self, method):
        def new_method(*args, **kwargs):
            with patch(
                    'pandas.DataFrame',
                    OrangeDataFrame
            ):
                df = method(*args, **kwargs)
            df.__finalize__(self)
            return df

        return new_method

    @property
    def _constructor(self):
        return OrangeDataFrame

    def to_orange_table(self):
        return table_from_frame(self)

    def __finalize__(self, other, method=None, **_):
        """
        propagate metadata from other to self

        Parameters
        ----------
        other : the object from which to get the attributes that we are going
            to propagate
        method : optional, a passed method name ; possibly to take different
            types of propagation actions based on this

        """
        if method == 'concat':
            objs = other.objs
        elif method == 'merge':
            objs = other.left, other.right
        else:
            objs = [other]

        orange_role = getattr(self, 'orange_role', None)
        dicts = {dname: getattr(self, dname, {})
                 for dname in ('orange_variables',
                               'orange_weights',
                               'orange_attributes')}
        for obj in objs:
            other_role = getattr(obj, 'orange_role', None)
            if other_role is not None:
                orange_role = other_role

            for dname, dict_ in dicts.items():
                other_dict = getattr(obj, dname, {})
                dict_.update(other_dict)

        object.__setattr__(self, 'orange_role', orange_role)
        for dname, dict_ in dicts.items():
            object.__setattr__(self, dname, dict_)

        return self

    pd.DataFrame.__finalize__ = __finalize__


def _is_discrete(s, force_nominal):
    return (is_categorical_dtype(s) or
            is_object_dtype(s) and (force_nominal or
                                    s.nunique() < s.size ** .666))


def _is_datetime(s):
    if is_datetime64_any_dtype(s):
        return True
    try:
        if is_object_dtype(s):
            pd.to_datetime(s, infer_datetime_format=True)
            return True
    except Exception:  # pylint: disable=broad-except
        pass
    return False


def vars_from_df(df, role=None, force_nominal=False):
    if role is None and hasattr(df, 'orange_role'):
        _role = df.orange_role
    else:
        _role = role

    # If df index is not a simple RangeIndex (or similar), put it into data
    if not any(str(i).startswith('_o') for i in df.index) \
            and not (df.index.is_integer() and (df.index.is_monotonic_increasing
                                                or df.index.is_monotonic_decreasing)):
        df = df.reset_index()

    Xcols, Ycols, Mcols = [], [], []
    Xexpr, Yexpr, Mexpr = [], [], []
    attrs, class_vars, metas = [], [], []

    contains_strings = _role == Role.Meta
    for column in df.columns:
        s = df[column]
        if hasattr(df, 'orange_variables') and column in df.orange_variables:
            original_var = df.orange_variables[column]
            var = original_var.copy(compute_value=None)
            if _role == Role.Attribute:
                Xcols.append(column)
                Xexpr.append(None)
                attrs.append(var)
            elif _role == Role.ClassAttribute:
                Ycols.append(column)
                Yexpr.append(None)
                class_vars.append(var)
            else:  # if role == Role.Meta:
                Mcols.append(column)
                Mexpr.append(None)
                metas.append(var)
        elif _is_discrete(s, force_nominal):
            discrete = s.astype('category').cat
            var = DiscreteVariable(str(column),
                                   discrete.categories.astype(str).tolist())
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(lambda s, _: np.asarray(
                s.astype('category').cat.codes.replace(-1, np.nan)
            ))
        elif _is_datetime(s):
            var = TimeVariable(str(column))
            s = pd.to_datetime(s, infer_datetime_format=True)
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(lambda s, v: np.asarray(
                s.astype('str').replace('NaT', np.nan).map(v.parse)
            ))
        elif is_numeric_dtype(s):
            var = ContinuousVariable(
                # set number of decimals to 0 if int else keeps default behaviour
                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)
            )
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(None)
        else:
            contains_strings = True
            var = StringVariable(str(column))
            metas.append(var)
            Mcols.append(column)
            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))

    # if role isn't explicitly set, try to
    # export dataframes into one contiguous block.
    # for this all columns must be of the same role
    if isinstance(df, OrangeDataFrame) \
            and not role \
            and contains_strings \
            and not force_nominal:
        attrs.extend(class_vars)
        attrs.extend(metas)
        metas = attrs
        Xcols.extend(Ycols)
        Xcols.extend(Mcols)
        Mcols = Xcols
        Xexpr.extend(Yexpr)
        Xexpr.extend(Mexpr)
        Mexpr = Xexpr

        attrs, class_vars = [], []
        Xcols, Ycols = [], []
        Xexpr, Yexpr = [], []

    XYM = []
    for Avars, Acols, Aexpr in zip(
            (attrs, class_vars, metas),
            (Xcols, Ycols, Mcols),
            (Xexpr, Yexpr, Mexpr)):
        if not Acols:
            A = None if Acols != Xcols else np.empty((df.shape[0], 0))
            XYM.append(A)
            continue
        if not any(Aexpr):
            Adf = df if all(c in Acols
                            for c in df.columns) else df[Acols]
            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):
                A = csr_matrix(Adf.sparse.to_coo())
            else:
                A = np.asarray(Adf)
            XYM.append(A)
            continue
        # we'll have to copy the table to resolve any expressions
        # TODO eliminate expr (preprocessing for pandas -> table)
        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])
                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T
        XYM.append(A)

    return XYM, Domain(attrs, class_vars, metas)


def table_from_frame(df, *, force_nominal=False):
    XYM, domain = vars_from_df(df, force_nominal=force_nominal)

    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):
        W = [df.orange_weights[i] for i in df.index
             if i in df.orange_weights]
        if len(W) != len(df.index):
            W = None
        attributes = df.orange_attributes
        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()
               for i in df.index]
    else:
        W = None
        attributes = None
        ids = None

    return Table.from_numpy(
        domain,
        *XYM,
        W=W,
        attributes=attributes,
        ids=ids
    )


def table_from_frames(xdf, ydf, mdf):
    dfs = xdf, ydf, mdf

    if not all(df.shape[0] == xdf.shape[0] for df in dfs):
        raise ValueError(f"Leading dimension mismatch "
                         f"(not {xdf.shape[0]} == {ydf.shape[0]} == {mdf.shape[0]})")

    xXYM, xDomain = vars_from_df(xdf, role=Role.Attribute)
    yXYM, yDomain = vars_from_df(ydf, role=Role.ClassAttribute)
    mXYM, mDomain = vars_from_df(mdf, role=Role.Meta)

    XYM = (xXYM[0], yXYM[1], mXYM[2])
    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)

    index_iter = (filter(lambda ind: ind.startswith('_o'),
                         set(df.index[i] for df in dfs))
                  for i in range(len(xdf.shape[0])))
    ids = (i[0] if len(i) == 1 else Table.new_id()
           for i in index_iter)

    attributes = {}
    W = None
    for df in dfs:
        if isinstance(df, OrangeDataFrame):
            W = [df.orange_weights[i] for i in df.index
                 if i in df.orange_weights]
            if len(W) != len(df.index):
                W = None
        else:
            W = None
        attributes.update(df.orange_attributes)

    return Table.from_numpy(
        domain,
        *XYM,
        W=W,
        attributes=attributes,
        ids=ids
    )


def table_to_frame(tab, include_metas=False):
    """
    Convert Orange.data.Table to pandas.DataFrame

    Parameters
    ----------
    tab : Table

    include_metas : bool, (default=False)
        Include table metas into dataframe.

    Returns
    -------
    pandas.DataFrame
    """

    def _column_to_series(col, vals):
        result = ()
        if col.is_discrete:
            codes = pd.Series(vals).fillna(-1).astype(int)
            result = (col.name, pd.Categorical.from_codes(
                codes=codes, categories=col.values, ordered=True
            ))
        elif col.is_time:
            result = (col.name, pd.to_datetime(vals, unit='s').to_series().reset_index()[0])
        elif col.is_continuous:
            dt = float
            # np.nan are not compatible with int column
            if col.number_of_decimals == 0 and not np.any(np.isnan(vals)):
                dt = int
            result = (col.name, pd.Series(vals).astype(dt))
        elif col.is_string:
            result = (col.name, pd.Series(vals))
        return result

    def _columns_to_series(cols, vals):
        return [_column_to_series(col, vals[:, i]) for i, col in enumerate(cols)]

    x, y, metas = [], [], []
    domain = tab.domain
    if domain.attributes:
        x = _columns_to_series(domain.attributes, tab.X)
    if domain.class_vars:
        y_values = tab.Y.reshape(tab.Y.shape[0], len(domain.class_vars))
        y = _columns_to_series(domain.class_vars, y_values)
    if domain.metas:
        metas = _columns_to_series(domain.metas, tab.metas)
    all_series = dict(x + y + metas)
    all_vars = tab.domain.variables
    if include_metas:
        all_vars += tab.domain.metas
    original_column_order = [var.name for var in all_vars]
    unsorted_columns_df = pd.DataFrame(all_series)
    return unsorted_columns_df[original_column_order]


def table_to_frames(table):
    xdf = OrangeDataFrame(table, Role.Attribute)
    ydf = OrangeDataFrame(table, Role.ClassAttribute)
    mdf = OrangeDataFrame(table, Role.Meta)

    return xdf, ydf, mdf


def amend_table_with_frame(table, df, role):
    arr = Role.get_arr(role, table)
    if arr.shape[0] != df.shape[0]:
        raise ValueError(f"Leading dimension mismatch "
                         f"(not {arr.shape[0]} == {df.shape[0]})")

    XYM, domain = vars_from_df(df, role=role)

    if role == Role.Attribute:
        table.domain = Domain(domain.attributes,
                              table.domain.class_vars,
                              table.domain.metas)
        table.X = XYM[0]
    elif role == Role.ClassAttribute:
        table.domain = Domain(table.domain.attributes,
                              domain.class_vars,
                              table.domain.metas)
        table.Y = XYM[1]
    else:  # if role == Role.Meta:
        table.domain = Domain(table.domain.attributes,
                              table.domain.class_vars,
                              domain.metas)
        table.metas = XYM[2]

    if isinstance(df, OrangeDataFrame):
        table.attributes.update(df.orange_attributes)

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]

**Title:** `table_from_frame` Raises ValueError with Non-Integer String Indices

**Description:**
When converting a pandas DataFrame to an Orange Table using `table_from_frame`, the function fails if the DataFrame's index contains non-integer strings. This issue arises because the function attempts to convert parts of the index to integers without handling cases where the conversion isn't possible.

**Example Buggy Code:**
```python
from Orange.data.pandas_compat import table_from_frame
from Orange.data import Table
import pandas as pd

# Create a DataFrame with mixed index types
df = pd.DataFrame({
    'feature': [1, 2, 3, 4, 5, 6],
    'target': ['a', 'b', 'c', 'd', 'e', 'f']
})
df.index = [1, "_oa", "_o", "1", "_o20", "_o30"]

# Attempt to convert to Orange Table
table = table_from_frame(df)
```

**Expected Behavior:**
The function should correctly handle indices with the `_o` prefix by extracting the numeric part where applicable and assigning appropriate IDs. Indices that do not follow the expected format should be handled gracefully, possibly by assigning new unique IDs without raising errors.

**Actual Behavior:**
A `ValueError` is raised with the message:
```
ValueError: invalid literal for int() with base 10: 'a'
```
This error occurs because the function attempts to convert parts of the index that are not purely numeric, leading to a failure when encountering unexpected string values.

[/ISSUE]
{
    "TestPandasCompat.test_not_orangedf": "PASSED",
    "TestPandasCompat.test_table_from_frame": "PASSED",
    "TestPandasCompat.test_table_from_frame_keep_ids": "PASSED",
    "TestPandasCompat.test_table_to_frame": "PASSED",
    "TestPandasCompat.test_table_to_frame_metas": "PASSED",
    "TestPandasCompat.test_table_to_frame_nans": "PASSED",
    "TestDenseTablePandas.test_amend": "PASSED",
    "TestDenseTablePandas.test_amend_dimension_mismatch": "PASSED",
    "TestDenseTablePandas.test_basic": "PASSED",
    "TestDenseTablePandas.test_concat_df": "PASSED",
    "TestDenseTablePandas.test_concat_table": "PASSED",
    "TestDenseTablePandas.test_contiguous_x": "PASSED",
    "TestDenseTablePandas.test_contiguous_y": "PASSED",
    "TestDenseTablePandas.test_copy": "PASSED",
    "TestDenseTablePandas.test_merge": "PASSED",
    "TestDenseTablePandas.test_new_column": "PASSED",
    "TestDenseTablePandas.test_selection": "PASSED",
    "TestDenseTablePandas.test_slice": "PASSED",
    "TestDenseTablePandas.test_to_dfs": "PASSED",
    "TestSparseTablePandas.test_basic": "PASSED",
    "TestSparseTablePandas.test_concat_df": "PASSED",
    "TestSparseTablePandas.test_concat_table": "PASSED",
    "TestSparseTablePandas.test_copy": "PASSED",
    "TestSparseTablePandas.test_merge": "PASSED",
    "TestSparseTablePandas.test_new_column": "PASSED",
    "TestSparseTablePandas.test_selection": "PASSED",
    "TestSparseTablePandas.test_slice": "PASSED",
    "TestSparseTablePandas.test_to_dense": "PASSED",
    "TestDenseTablePandas.test_contiguous_metas": "FAILED"
}
diff --git a/Orange/data/pandas_compat.py b/Orange/data/pandas_compat.py
index 401902f4a..b37913164 100644
--- a/Orange/data/pandas_compat.py
+++ b/Orange/data/pandas_compat.py
@@ -2,6 +2,7 @@
 from unittest.mock import patch
 
 import numpy as np
+from pandas.core.dtypes.common import is_string_dtype
 from scipy import sparse as sp
 from scipy.sparse import csr_matrix
 import pandas as pd
@@ -170,9 +171,20 @@ def vars_from_df(df, role=None, force_nominal=False):
         _role = role
 
     # If df index is not a simple RangeIndex (or similar), put it into data
-    if not any(str(i).startswith('_o') for i in df.index) \
-            and not (df.index.is_integer() and (df.index.is_monotonic_increasing
-                                                or df.index.is_monotonic_decreasing)):
+    if (
+        # not range-like index - test first to skip slow startswith(_o) check
+        not (
+            df.index.is_integer()
+            and (df.index.is_monotonic_increasing or df.index.is_monotonic_decreasing)
+        )
+        # check that it does not contain Orange index
+        and (
+            # startswith is slow (for long drs) - firs check if col has strings
+            isinstance(df.index, pd.MultiIndex)
+            or not is_string_dtype(df.index)
+            or not any(str(i).startswith("_o") for i in df.index)
+        )
+    ):
         df = df.reset_index()
 
     Xcols, Ycols, Mcols = [], [], []
@@ -180,6 +192,7 @@ def vars_from_df(df, role=None, force_nominal=False):
     attrs, class_vars, metas = [], [], []
 
     contains_strings = _role == Role.Meta
+
     for column in df.columns:
         s = df[column]
         if hasattr(df, 'orange_variables') and column in df.orange_variables:
@@ -203,12 +216,16 @@ def vars_from_df(df, role=None, force_nominal=False):
                                    discrete.categories.astype(str).tolist())
             attrs.append(var)
             Xcols.append(column)
-            Xexpr.append(lambda s, _: np.asarray(
-                s.astype('category').cat.codes.replace(-1, np.nan)
-            ))
+
+            def to_cat(s, _):
+                x = s.astype("category").cat.codes
+                # it is same than x.replace(-1, np.nan), but much faster
+                x = x.where(x != -1, np.nan)
+                return np.asarray(x)
+
+            Xexpr.append(to_cat)
         elif _is_datetime(s):
             var = TimeVariable(str(column))
-            s = pd.to_datetime(s, infer_datetime_format=True)
             attrs.append(var)
             Xcols.append(column)
             Xexpr.append(lambda s, v: np.asarray(
@@ -281,13 +298,21 @@ def table_from_frame(df, *, force_nominal=False):
     XYM, domain = vars_from_df(df, force_nominal=force_nominal)
 
     if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):
-        W = [df.orange_weights[i] for i in df.index
-             if i in df.orange_weights]
+        W = [df.orange_weights[i] for i in df.index if i in df.orange_weights]
         if len(W) != len(df.index):
             W = None
         attributes = df.orange_attributes
-        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()
-               for i in df.index]
+        if isinstance(df.index, pd.MultiIndex) or not is_string_dtype(df.index):
+            # we can skip checking for Orange indices when MultiIndex an when
+            # not string dtype and so speedup the conversion
+            ids = None
+        else:
+            ids = [
+                int(i[2:])
+                if str(i).startswith("_o") and i[2:].isdigit()
+                else Table.new_id()
+                for i in df.index
+            ]
     else:
         W = None
         attributes = None

{"Orange/data/pandas_compat.py": "\"\"\"Pandas DataFrame\u2194Table conversion helpers\"\"\"\nfrom unittest.mock import patch\n\nimport numpy as np\nfrom scipy import sparse as sp\nfrom scipy.sparse import csr_matrix\nimport pandas as pd\nfrom pandas.core.arrays import SparseArray\nfrom pandas.core.arrays.sparse.dtype import SparseDtype\nfrom pandas.api.types import (\n    is_categorical_dtype, is_object_dtype,\n    is_datetime64_any_dtype, is_numeric_dtype, is_integer_dtype\n)\n\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, StringVariable, TimeVariable,\n    ContinuousVariable,\n)\nfrom Orange.data.table import Role\n\n__all__ = ['table_from_frame', 'table_to_frame']\n\n\nclass OrangeDataFrame(pd.DataFrame):\n    _metadata = [\"orange_variables\", \"orange_weights\",\n                 \"orange_attributes\", \"orange_role\"]\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        A pandas DataFrame wrapper for one of Table's numpy arrays:\n            - sets index values corresponding to Orange's global row indices\n              e.g. ['_o1', '_o2'] (allows Orange to handle selection)\n            - remembers the array's role in the Table (attribute, class var, meta)\n            - keeps the Variable objects, and uses them in back-to-table conversion,\n              should a column name match a variable's name\n            - stores weight values (legacy)\n\n        Parameters\n        ----------\n        table : Table\n        orange_role : Role, (default=Role.Attribute)\n            When converting back to an orange table, the DataFrame will\n            convert to the right role (attrs, class vars, or metas)\n        \"\"\"\n        if len(args) <= 0 or not isinstance(args[0], Table):\n            super().__init__(*args, **kwargs)\n            return\n        table = args[0]\n        if 'orange_role' in kwargs:\n            role = kwargs.pop('orange_role')\n        elif len(args) >= 2:\n            role = args[1]\n        else:\n            role = Role.Attribute\n\n        if role == Role.Attribute:\n            data = table.X\n            vars_ = table.domain.attributes\n        elif role == Role.ClassAttribute:\n            data = table.Y\n            vars_ = table.domain.class_vars\n        else:  # if role == Role.Meta:\n            data = table.metas\n            vars_ = table.domain.metas\n\n        index = ['_o' + str(id_) for id_ in table.ids]\n        varsdict = {var._name: var for var in vars_}\n        columns = varsdict.keys()\n\n        if sp.issparse(data):\n            data = data.asformat('csc')\n            sparrays = [SparseArray.from_spmatrix(data[:, i]) for i in range(data.shape[1])]\n            data = dict(enumerate(sparrays))\n            super().__init__(data, index=index, **kwargs)\n            self.columns = columns\n            # a hack to keep Orange df _metadata in sparse->dense conversion\n            self.sparse.to_dense = self.__patch_constructor(self.sparse.to_dense)\n        else:\n            super().__init__(data=data, index=index, columns=columns, **kwargs)\n\n        self.orange_role = role\n        self.orange_variables = varsdict\n        self.orange_weights = (dict(zip(index, table.W))\n                               if table.W.size > 0 else {})\n        self.orange_attributes = table.attributes\n\n    def __patch_constructor(self, method):\n        def new_method(*args, **kwargs):\n            with patch(\n                    'pandas.DataFrame',\n                    OrangeDataFrame\n            ):\n                df = method(*args, **kwargs)\n            df.__finalize__(self)\n            return df\n\n        return new_method\n\n    @property\n    def _constructor(self):\n        return OrangeDataFrame\n\n    def to_orange_table(self):\n        return table_from_frame(self)\n\n    def __finalize__(self, other, method=None, **_):\n        \"\"\"\n        propagate metadata from other to self\n\n        Parameters\n        ----------\n        other : the object from which to get the attributes that we are going\n            to propagate\n        method : optional, a passed method name ; possibly to take different\n            types of propagation actions based on this\n\n        \"\"\"\n        if method == 'concat':\n            objs = other.objs\n        elif method == 'merge':\n            objs = other.left, other.right\n        else:\n            objs = [other]\n\n        orange_role = getattr(self, 'orange_role', None)\n        dicts = {dname: getattr(self, dname, {})\n                 for dname in ('orange_variables',\n                               'orange_weights',\n                               'orange_attributes')}\n        for obj in objs:\n            other_role = getattr(obj, 'orange_role', None)\n            if other_role is not None:\n                orange_role = other_role\n\n            for dname, dict_ in dicts.items():\n                other_dict = getattr(obj, dname, {})\n                dict_.update(other_dict)\n\n        object.__setattr__(self, 'orange_role', orange_role)\n        for dname, dict_ in dicts.items():\n            object.__setattr__(self, dname, dict_)\n\n        return self\n\n    pd.DataFrame.__finalize__ = __finalize__\n\n\ndef _is_discrete(s, force_nominal):\n    return (is_categorical_dtype(s) or\n            is_object_dtype(s) and (force_nominal or\n                                    s.nunique() < s.size ** .666))\n\n\ndef _is_datetime(s):\n    if is_datetime64_any_dtype(s):\n        return True\n    try:\n        if is_object_dtype(s):\n            pd.to_datetime(s, infer_datetime_format=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef vars_from_df(df, role=None, force_nominal=False):\n    if role is None and hasattr(df, 'orange_role'):\n        _role = df.orange_role\n    else:\n        _role = role\n\n    # If df index is not a simple RangeIndex (or similar), put it into data\n    if not any(str(i).startswith('_o') for i in df.index) \\\n            and not (df.index.is_integer() and (df.index.is_monotonic_increasing\n                                                or df.index.is_monotonic_decreasing)):\n        df = df.reset_index()\n\n    Xcols, Ycols, Mcols = [], [], []\n    Xexpr, Yexpr, Mexpr = [], [], []\n    attrs, class_vars, metas = [], [], []\n\n    contains_strings = _role == Role.Meta\n    for column in df.columns:\n        s = df[column]\n        if hasattr(df, 'orange_variables') and column in df.orange_variables:\n            original_var = df.orange_variables[column]\n            var = original_var.copy(compute_value=None)\n            if _role == Role.Attribute:\n                Xcols.append(column)\n                Xexpr.append(None)\n                attrs.append(var)\n            elif _role == Role.ClassAttribute:\n                Ycols.append(column)\n                Yexpr.append(None)\n                class_vars.append(var)\n            else:  # if role == Role.Meta:\n                Mcols.append(column)\n                Mexpr.append(None)\n                metas.append(var)\n        elif _is_discrete(s, force_nominal):\n            discrete = s.astype('category').cat\n            var = DiscreteVariable(str(column),\n                                   discrete.categories.astype(str).tolist())\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, _: np.asarray(\n                s.astype('category').cat.codes.replace(-1, np.nan)\n            ))\n        elif _is_datetime(s):\n            var = TimeVariable(str(column))\n            s = pd.to_datetime(s, infer_datetime_format=True)\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(lambda s, v: np.asarray(\n                s.astype('str').replace('NaT', np.nan).map(v.parse)\n            ))\n        elif is_numeric_dtype(s):\n            var = ContinuousVariable(\n                # set number of decimals to 0 if int else keeps default behaviour\n                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)\n            )\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(None)\n        else:\n            contains_strings = True\n            var = StringVariable(str(column))\n            metas.append(var)\n            Mcols.append(column)\n            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))\n\n    # if role isn't explicitly set, try to\n    # export dataframes into one contiguous block.\n    # for this all columns must be of the same role\n    if isinstance(df, OrangeDataFrame) \\\n            and not role \\\n            and contains_strings \\\n            and not force_nominal:\n        attrs.extend(class_vars)\n        attrs.extend(metas)\n        metas = attrs\n        Xcols.extend(Ycols)\n        Xcols.extend(Mcols)\n        Mcols = Xcols\n        Xexpr.extend(Yexpr)\n        Xexpr.extend(Mexpr)\n        Mexpr = Xexpr\n\n        attrs, class_vars = [], []\n        Xcols, Ycols = [], []\n        Xexpr, Yexpr = [], []\n\n    XYM = []\n    for Avars, Acols, Aexpr in zip(\n            (attrs, class_vars, metas),\n            (Xcols, Ycols, Mcols),\n            (Xexpr, Yexpr, Mexpr)):\n        if not Acols:\n            A = None if Acols != Xcols else np.empty((df.shape[0], 0))\n            XYM.append(A)\n            continue\n        if not any(Aexpr):\n            Adf = df if all(c in Acols\n                            for c in df.columns) else df[Acols]\n            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):\n                A = csr_matrix(Adf.sparse.to_coo())\n            else:\n                A = np.asarray(Adf)\n            XYM.append(A)\n            continue\n        # we'll have to copy the table to resolve any expressions\n        # TODO eliminate expr (preprocessing for pandas -> table)\n        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])\n                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T\n        XYM.append(A)\n\n    return XYM, Domain(attrs, class_vars, metas)\n\n\ndef table_from_frame(df, *, force_nominal=False):\n    XYM, domain = vars_from_df(df, force_nominal=force_nominal)\n\n    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):\n        W = [df.orange_weights[i] for i in df.index\n             if i in df.orange_weights]\n        if len(W) != len(df.index):\n            W = None\n        attributes = df.orange_attributes\n        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()\n               for i in df.index]\n    else:\n        W = None\n        attributes = None\n        ids = None\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_from_frames(xdf, ydf, mdf):\n    dfs = xdf, ydf, mdf\n\n    if not all(df.shape[0] == xdf.shape[0] for df in dfs):\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {xdf.shape[0]} == {ydf.shape[0]} == {mdf.shape[0]})\")\n\n    xXYM, xDomain = vars_from_df(xdf, role=Role.Attribute)\n    yXYM, yDomain = vars_from_df(ydf, role=Role.ClassAttribute)\n    mXYM, mDomain = vars_from_df(mdf, role=Role.Meta)\n\n    XYM = (xXYM[0], yXYM[1], mXYM[2])\n    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)\n\n    index_iter = (filter(lambda ind: ind.startswith('_o'),\n                         set(df.index[i] for df in dfs))\n                  for i in range(len(xdf.shape[0])))\n    ids = (i[0] if len(i) == 1 else Table.new_id()\n           for i in index_iter)\n\n    attributes = {}\n    W = None\n    for df in dfs:\n        if isinstance(df, OrangeDataFrame):\n            W = [df.orange_weights[i] for i in df.index\n                 if i in df.orange_weights]\n            if len(W) != len(df.index):\n                W = None\n        else:\n            W = None\n        attributes.update(df.orange_attributes)\n\n    return Table.from_numpy(\n        domain,\n        *XYM,\n        W=W,\n        attributes=attributes,\n        ids=ids\n    )\n\n\ndef table_to_frame(tab, include_metas=False):\n    \"\"\"\n    Convert Orange.data.Table to pandas.DataFrame\n\n    Parameters\n    ----------\n    tab : Table\n\n    include_metas : bool, (default=False)\n        Include table metas into dataframe.\n\n    Returns\n    -------\n    pandas.DataFrame\n    \"\"\"\n\n    def _column_to_series(col, vals):\n        result = ()\n        if col.is_discrete:\n            codes = pd.Series(vals).fillna(-1).astype(int)\n            result = (col.name, pd.Categorical.from_codes(\n                codes=codes, categories=col.values, ordered=True\n            ))\n        elif col.is_time:\n            result = (col.name, pd.to_datetime(vals, unit='s').to_series().reset_index()[0])\n        elif col.is_continuous:\n            dt = float\n            # np.nan are not compatible with int column\n            if col.number_of_decimals == 0 and not np.any(np.isnan(vals)):\n                dt = int\n            result = (col.name, pd.Series(vals).astype(dt))\n        elif col.is_string:\n            result = (col.name, pd.Series(vals))\n        return result\n\n    def _columns_to_series(cols, vals):\n        return [_column_to_series(col, vals[:, i]) for i, col in enumerate(cols)]\n\n    x, y, metas = [], [], []\n    domain = tab.domain\n    if domain.attributes:\n        x = _columns_to_series(domain.attributes, tab.X)\n    if domain.class_vars:\n        y_values = tab.Y.reshape(tab.Y.shape[0], len(domain.class_vars))\n        y = _columns_to_series(domain.class_vars, y_values)\n    if domain.metas:\n        metas = _columns_to_series(domain.metas, tab.metas)\n    all_series = dict(x + y + metas)\n    all_vars = tab.domain.variables\n    if include_metas:\n        all_vars += tab.domain.metas\n    original_column_order = [var.name for var in all_vars]\n    unsorted_columns_df = pd.DataFrame(all_series)\n    return unsorted_columns_df[original_column_order]\n\n\ndef table_to_frames(table):\n    xdf = OrangeDataFrame(table, Role.Attribute)\n    ydf = OrangeDataFrame(table, Role.ClassAttribute)\n    mdf = OrangeDataFrame(table, Role.Meta)\n\n    return xdf, ydf, mdf\n\n\ndef amend_table_with_frame(table, df, role):\n    arr = Role.get_arr(role, table)\n    if arr.shape[0] != df.shape[0]:\n        raise ValueError(f\"Leading dimension mismatch \"\n                         f\"(not {arr.shape[0]} == {df.shape[0]})\")\n\n    XYM, domain = vars_from_df(df, role=role)\n\n    if role == Role.Attribute:\n        table.domain = Domain(domain.attributes,\n                              table.domain.class_vars,\n                              table.domain.metas)\n        table.X = XYM[0]\n    elif role == Role.ClassAttribute:\n        table.domain = Domain(table.domain.attributes,\n                              domain.class_vars,\n                              table.domain.metas)\n        table.Y = XYM[1]\n    else:  # if role == Role.Meta:\n        table.domain = Domain(table.domain.attributes,\n                              table.domain.class_vars,\n                              domain.metas)\n        table.metas = XYM[2]\n\n    if isinstance(df, OrangeDataFrame):\n        table.attributes.update(df.orange_attributes)\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** `table_from_frame` Raises ValueError with Non-Integer String Indices

**Description:**
When converting a pandas DataFrame to an Orange Table using `table_from_frame`, the function fails if the DataFrame's index contains non-integer strings. This issue arises because the function attempts to convert parts of the index to integers without handling cases where the conversion isn't possible.

**Example Buggy Code:**
```python
from Orange.data.pandas_compat import table_from_frame
from Orange.data import Table
import pandas as pd

# Create a DataFrame with mixed index types
df = pd.DataFrame({
    'feature': [1, 2, 3, 4, 5, 6],
    'target': ['a', 'b', 'c', 'd', 'e', 'f']
})
df.index = [1, "_oa", "_o", "1", "_o20", "_o30"]

# Attempt to convert to Orange Table
table = table_from_frame(df)
```

**Expected Behavior:**
The function should correctly handle indices with the `_o` prefix by extracting the numeric part where applicable and assigning appropriate IDs. Indices that do not follow the expected format should be handled gracefully, possibly by assigning new unique IDs without raising errors.

**Actual Behavior:**
A `ValueError` is raised with the message:
```
ValueError: invalid literal for int() with base 10: 'a'
```
This error occurs because the function attempts to convert parts of the index that are not purely numeric, leading to a failure when encountering unexpected string values.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/data/pandas_compat.py
"""Pandas DataFrame↔Table conversion helpers"""
from unittest.mock import patch

import numpy as np
from scipy import sparse as sp
from scipy.sparse import csr_matrix
import pandas as pd
from pandas.core.arrays import SparseArray
from pandas.core.arrays.sparse.dtype import SparseDtype
from pandas.api.types import (
    is_categorical_dtype, is_object_dtype,
    is_datetime64_any_dtype, is_numeric_dtype, is_integer_dtype
)

from Orange.data import (
    Table, Domain, DiscreteVariable, StringVariable, TimeVariable,
    ContinuousVariable,
)
from Orange.data.table import Role

__all__ = ['table_from_frame', 'table_to_frame']


class OrangeDataFrame(pd.DataFrame):
    _metadata = ["orange_variables", "orange_weights",
                 "orange_attributes", "orange_role"]

    def __init__(self, *args, **kwargs):
        """
        A pandas DataFrame wrapper for one of Table's numpy arrays:
            - sets index values corresponding to Orange's global row indices
              e.g. ['_o1', '_o2'] (allows Orange to handle selection)
            - remembers the array's role in the Table (attribute, class var, meta)
            - keeps the Variable objects, and uses them in back-to-table conversion,
              should a column name match a variable's name
            - stores weight values (legacy)

        Parameters
        ----------
        table : Table
        orange_role : Role, (default=Role.Attribute)
            When converting back to an orange table, the DataFrame will
            convert to the right role (attrs, class vars, or metas)
        """
        if len(args) <= 0 or not isinstance(args[0], Table):
            super().__init__(*args, **kwargs)
            return
        table = args[0]
        if 'orange_role' in kwargs:
            role = kwargs.pop('orange_role')
        elif len(args) >= 2:
            role = args[1]
        else:
            role = Role.Attribute

        if role == Role.Attribute:
            data = table.X
            vars_ = table.domain.attributes
        elif role == Role.ClassAttribute:
            data = table.Y
            vars_ = table.domain.class_vars
        else:  # if role == Role.Meta:
            data = table.metas
            vars_ = table.domain.metas

        index = ['_o' + str(id_) for id_ in table.ids]
        varsdict = {var._name: var for var in vars_}
        columns = varsdict.keys()

        if sp.issparse(data):
            data = data.asformat('csc')
            sparrays = [SparseArray.from_spmatrix(data[:, i]) for i in range(data.shape[1])]
            data = dict(enumerate(sparrays))
            super().__init__(data, index=index, **kwargs)
            self.columns = columns
            # a hack to keep Orange df _metadata in sparse->dense conversion
            self.sparse.to_dense = self.__patch_constructor(self.sparse.to_dense)
        else:
            super().__init__(data=data, index=index, columns=columns, **kwargs)

        self.orange_role = role
        self.orange_variables = varsdict
        self.orange_weights = (dict(zip(index, table.W))
                               if table.W.size > 0 else {})
        self.orange_attributes = table.attributes

    def __patch_constructor(self, method):
        def new_method(*args, **kwargs):
            with patch(
                    'pandas.DataFrame',
                    OrangeDataFrame
            ):
                df = method(*args, **kwargs)
            df.__finalize__(self)
            return df

        return new_method

    @property
    def _constructor(self):
        return OrangeDataFrame

    def to_orange_table(self):
        return table_from_frame(self)

    def __finalize__(self, other, method=None, **_):
        """
        propagate metadata from other to self

        Parameters
        ----------
        other : the object from which to get the attributes that we are going
            to propagate
        method : optional, a passed method name ; possibly to take different
            types of propagation actions based on this

        """
        if method == 'concat':
            objs = other.objs
        elif method == 'merge':
            objs = other.left, other.right
        else:
            objs = [other]

        orange_role = getattr(self, 'orange_role', None)
        dicts = {dname: getattr(self, dname, {})
                 for dname in ('orange_variables',
                               'orange_weights',
                               'orange_attributes')}
        for obj in objs:
            other_role = getattr(obj, 'orange_role', None)
            if other_role is not None:
                orange_role = other_role

            for dname, dict_ in dicts.items():
                other_dict = getattr(obj, dname, {})
                dict_.update(other_dict)

        object.__setattr__(self, 'orange_role', orange_role)
        for dname, dict_ in dicts.items():
            object.__setattr__(self, dname, dict_)

        return self

    pd.DataFrame.__finalize__ = __finalize__


def _is_discrete(s, force_nominal):
    return (is_categorical_dtype(s) or
            is_object_dtype(s) and (force_nominal or
                                    s.nunique() < s.size ** .666))


def _is_datetime(s):
    if is_datetime64_any_dtype(s):
        return True
    try:
        if is_object_dtype(s):
            pd.to_datetime(s, infer_datetime_format=True)
            return True
    except Exception:  # pylint: disable=broad-except
        pass
    return False


def vars_from_df(df, role=None, force_nominal=False):
    if role is None and hasattr(df, 'orange_role'):
        _role = df.orange_role
    else:
        _role = role

    # If df index is not a simple RangeIndex (or similar), put it into data
    if not any(str(i).startswith('_o') for i in df.index) \
            and not (df.index.is_integer() and (df.index.is_monotonic_increasing
                                                or df.index.is_monotonic_decreasing)):
        df = df.reset_index()

    Xcols, Ycols, Mcols = [], [], []
    Xexpr, Yexpr, Mexpr = [], [], []
    attrs, class_vars, metas = [], [], []

    contains_strings = _role == Role.Meta
    for column in df.columns:
        s = df[column]
        if hasattr(df, 'orange_variables') and column in df.orange_variables:
            original_var = df.orange_variables[column]
            var = original_var.copy(compute_value=None)
            if _role == Role.Attribute:
                Xcols.append(column)
                Xexpr.append(None)
                attrs.append(var)
            elif _role == Role.ClassAttribute:
                Ycols.append(column)
                Yexpr.append(None)
                class_vars.append(var)
            else:  # if role == Role.Meta:
                Mcols.append(column)
                Mexpr.append(None)
                metas.append(var)
        elif _is_discrete(s, force_nominal):
            discrete = s.astype('category').cat
            var = DiscreteVariable(str(column),
                                   discrete.categories.astype(str).tolist())
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(lambda s, _: np.asarray(
                s.astype('category').cat.codes.replace(-1, np.nan)
            ))
        elif _is_datetime(s):
            var = TimeVariable(str(column))
            s = pd.to_datetime(s, infer_datetime_format=True)
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(lambda s, v: np.asarray(
                s.astype('str').replace('NaT', np.nan).map(v.parse)
            ))
        elif is_numeric_dtype(s):
            var = ContinuousVariable(
                # set number of decimals to 0 if int else keeps default behaviour
                str(column), number_of_decimals=(0 if is_integer_dtype(s) else None)
            )
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(None)
        else:
            contains_strings = True
            var = StringVariable(str(column))
            metas.append(var)
            Mcols.append(column)
            Mexpr.append(lambda s, _: np.asarray(s, dtype=object))

    # if role isn't explicitly set, try to
    # export dataframes into one contiguous block.
    # for this all columns must be of the same role
    if isinstance(df, OrangeDataFrame) \
            and not role \
            and contains_strings \
            and not force_nominal:
        attrs.extend(class_vars)
        attrs.extend(metas)
        metas = attrs
        Xcols.extend(Ycols)
        Xcols.extend(Mcols)
        Mcols = Xcols
        Xexpr.extend(Yexpr)
        Xexpr.extend(Mexpr)
        Mexpr = Xexpr

        attrs, class_vars = [], []
        Xcols, Ycols = [], []
        Xexpr, Yexpr = [], []

    XYM = []
    for Avars, Acols, Aexpr in zip(
            (attrs, class_vars, metas),
            (Xcols, Ycols, Mcols),
            (Xexpr, Yexpr, Mexpr)):
        if not Acols:
            A = None if Acols != Xcols else np.empty((df.shape[0], 0))
            XYM.append(A)
            continue
        if not any(Aexpr):
            Adf = df if all(c in Acols
                            for c in df.columns) else df[Acols]
            if all(isinstance(a, SparseDtype) for a in Adf.dtypes):
                A = csr_matrix(Adf.sparse.to_coo())
            else:
                A = np.asarray(Adf)
            XYM.append(A)
            continue
        # we'll have to copy the table to resolve any expressions
        # TODO eliminate expr (preprocessing for pandas -> table)
        A = np.array([expr(df[col], var) if expr else np.asarray(df[col])
                      for var, col, expr in zip(Avars, Acols, Aexpr)]).T
        XYM.append(A)

    return XYM, Domain(attrs, class_vars, metas)


def table_from_frame(df, *, force_nominal=False):
    XYM, domain = vars_from_df(df, force_nominal=force_nominal)

    if hasattr(df, 'orange_weights') and hasattr(df, 'orange_attributes'):
        W = [df.orange_weights[i] for i in df.index
             if i in df.orange_weights]
        if len(W) != len(df.index):
            W = None
        attributes = df.orange_attributes
        ids = [int(i[2:]) if str(i).startswith('_o') else Table.new_id()
               for i in df.index]
    else:
        W = None
        attributes = None
        ids = None

    return Table.from_numpy(
        domain,
        *XYM,
        W=W,
        attributes=attributes,
        ids=ids
    )


def table_from_frames(xdf, ydf, mdf):
    dfs = xdf, ydf, mdf

    if not all(df.shape[0] == xdf.shape[0] for df in dfs):
        raise ValueError(f"Leading dimension mismatch "
                         f"(not {xdf.shape[0]} == {ydf.shape[0]} == {mdf.shape[0]})")

    xXYM, xDomain = vars_from_df(xdf, role=Role.Attribute)
    yXYM, yDomain = vars_from_df(ydf, role=Role.ClassAttribute)
    mXYM, mDomain = vars_from_df(mdf, role=Role.Meta)

    XYM = (xXYM[0], yXYM[1], mXYM[2])
    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)

    index_iter = (filter(lambda ind: ind.startswith('_o'),
                         set(df.index[i] for df in dfs))
                  for i in range(len(xdf.shape[0])))
    ids = (i[0] if len(i) == 1 else Table.new_id()
           for i in index_iter)

    attributes = {}
    W = None
    for df in dfs:
        if isinstance(df, OrangeDataFrame):
            W = [df.orange_weights[i] for i in df.index
                 if i in df.orange_weights]
            if len(W) != len(df.index):
                W = None
        else:
            W = None
        attributes.update(df.orange_attributes)

    return Table.from_numpy(
        domain,
        *XYM,
        W=W,
        attributes=attributes,
        ids=ids
    )


def table_to_frame(tab, include_metas=False):
    """
    Convert Orange.data.Table to pandas.DataFrame

    Parameters
    ----------
    tab : Table

    include_metas : bool, (default=False)
        Include table metas into dataframe.

    Returns
    -------
    pandas.DataFrame
    """

    def _column_to_series(col, vals):
        result = ()
        if col.is_discrete:
            codes = pd.Series(vals).fillna(-1).astype(int)
            result = (col.name, pd.Categorical.from_codes(
                codes=codes, categories=col.values, ordered=True
            ))
        elif col.is_time:
            result = (col.name, pd.to_datetime(vals, unit='s').to_series().reset_index()[0])
        elif col.is_continuous:
            dt = float
            # np.nan are not compatible with int column
            if col.number_of_decimals == 0 and not np.any(np.isnan(vals)):
                dt = int
            result = (col.name, pd.Series(vals).astype(dt))
        elif col.is_string:
            result = (col.name, pd.Series(vals))
        return result

    def _columns_to_series(cols, vals):
        return [_column_to_series(col, vals[:, i]) for i, col in enumerate(cols)]

    x, y, metas = [], [], []
    domain = tab.domain
    if domain.attributes:
        x = _columns_to_series(domain.attributes, tab.X)
    if domain.class_vars:
        y_values = tab.Y.reshape(tab.Y.shape[0], len(domain.class_vars))
        y = _columns_to_series(domain.class_vars, y_values)
    if domain.metas:
        metas = _columns_to_series(domain.metas, tab.metas)
    all_series = dict(x + y + metas)
    all_vars = tab.domain.variables
    if include_metas:
        all_vars += tab.domain.metas
    original_column_order = [var.name for var in all_vars]
    unsorted_columns_df = pd.DataFrame(all_series)
    return unsorted_columns_df[original_column_order]


def table_to_frames(table):
    xdf = OrangeDataFrame(table, Role.Attribute)
    ydf = OrangeDataFrame(table, Role.ClassAttribute)
    mdf = OrangeDataFrame(table, Role.Meta)

    return xdf, ydf, mdf


def amend_table_with_frame(table, df, role):
    arr = Role.get_arr(role, table)
    if arr.shape[0] != df.shape[0]:
        raise ValueError(f"Leading dimension mismatch "
                         f"(not {arr.shape[0]} == {df.shape[0]})")

    XYM, domain = vars_from_df(df, role=role)

    if role == Role.Attribute:
        table.domain = Domain(domain.attributes,
                              table.domain.class_vars,
                              table.domain.metas)
        table.X = XYM[0]
    elif role == Role.ClassAttribute:
        table.domain = Domain(table.domain.attributes,
                              domain.class_vars,
                              table.domain.metas)
        table.Y = XYM[1]
    else:  # if role == Role.Meta:
        table.domain = Domain(table.domain.attributes,
                              table.domain.class_vars,
                              domain.metas)
        table.metas = XYM[2]

    if isinstance(df, OrangeDataFrame):
        table.attributes.update(df.orange_attributes)

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user