{
    "file_diffs": [
        {
            "old_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            # utc=True - to allow different timezones in a series object\n            pd.to_datetime(s, infer_datetime_format=True, utc=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef _convert_datetime(series, var):\n    def col_type(dt):\n        \"\"\"Test if is date, time or datetime\"\"\"\n        dt_nonnat = dt[~pd.isnull(dt)]  # nat == nat is False\n        if (dt_nonnat.dt.floor(\"d\") == dt_nonnat).all():\n            # all times are 00:00:00.0 - pure date\n            return 1, 0\n        elif (dt_nonnat.dt.date == pd.Timestamp(\"now\").date()).all():\n            # all dates are today's date - pure time\n            return 0, 1  # pure time\n        else:\n            # else datetime\n            return 1, 1\n\n    try:\n        dt = pd.to_datetime(series)\n    except ValueError:\n        # series with type object and different timezones will raise a\n        # ValueError - normalizing to utc\n        dt = pd.to_datetime(series, utc=True)\n\n    # set variable type to date, time or datetime\n    var.have_date, var.have_time = col_type(dt)\n\n    if dt.dt.tz is not None:\n        # set timezone if available and convert to utc\n        var.timezone = dt.dt.tz\n        dt = dt.dt.tz_convert(\"UTC\")\n\n    if var.have_time and not var.have_date:\n        # if time only measure seconds from midnight - equal to setting date\n        # to unix epoch\n        return (\n            (dt.dt.tz_localize(None) - pd.Timestamp(\"now\").normalize())\n            / pd.Timedelta(\"1s\")\n        ).values\n\n    return (\n        (dt.dt.tz_localize(None) - pd.Timestamp(\"1970-01-01\")) / pd.Timedelta(\"1s\")\n    ).values\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_datetime(s):\n            var = TimeVariable(str(column))\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(_convert_datetime)\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_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    # Let the tables share memory with pandas frame\n    if XYM[1] is not None and XYM[1].ndim == 2 and XYM[1].shape[1] == 1:\n        XYM[1] = XYM[1][:, 0]\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            # using pd.isnull since np.isnan fails on array with dtype object\n            # which can happen when metas contain column with strings\n            if col.number_of_decimals == 0 and not np.any(pd.isnull(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            # utc=True - to allow different timezones in a series object\n            pd.to_datetime(s, infer_datetime_format=True, utc=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef _convert_datetime(series, var):\n    def col_type(dt):\n        \"\"\"Test if is date, time or datetime\"\"\"\n        dt_nonnat = dt[~pd.isnull(dt)]  # nat == nat is False\n        if (dt_nonnat.dt.floor(\"d\") == dt_nonnat).all():\n            # all times are 00:00:00.0 - pure date\n            return 1, 0\n        elif (dt_nonnat.dt.date == pd.Timestamp(\"now\").date()).all():\n            # all dates are today's date - pure time\n            return 0, 1  # pure time\n        else:\n            # else datetime\n            return 1, 1\n\n    try:\n        dt = pd.to_datetime(series)\n    except ValueError:\n        # series with type object and different timezones will raise a\n        # ValueError - normalizing to utc\n        dt = pd.to_datetime(series, utc=True)\n\n    # set variable type to date, time or datetime\n    var.have_date, var.have_time = col_type(dt)\n\n    if dt.dt.tz is not None:\n        # set timezone if available and convert to utc\n        var.timezone = dt.dt.tz\n        dt = dt.dt.tz_convert(\"UTC\")\n\n    if var.have_time and not var.have_date:\n        # if time only measure seconds from midnight - equal to setting date\n        # to unix epoch\n        return (\n            (dt.dt.tz_localize(None) - pd.Timestamp(\"now\").normalize())\n            / pd.Timedelta(\"1s\")\n        ).values\n\n    return (\n        (dt.dt.tz_localize(None) - pd.Timestamp(\"1970-01-01\")) / pd.Timedelta(\"1s\")\n    ).values\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_datetime(s):\n            var = TimeVariable(str(column))\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(_convert_datetime)\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_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    # Let the tables share memory with pandas frame\n    if XYM[1] is not None and XYM[1].ndim == 2 and XYM[1].shape[1] == 1:\n        XYM[1] = XYM[1][:, 0]\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    indexes = [df.index for df in dfs]\n    ids = [\n        int(x[2:])\n        if str(x).startswith(\"_o\") and x[2:].isdigit() and x == y == m\n        else Table.new_id()\n        for x, y, m in zip(*indexes)\n    ]\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            # using pd.isnull since np.isnan fails on array with dtype object\n            # which can happen when metas contain column with strings\n            if col.number_of_decimals == 0 and not np.any(pd.isnull(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": "ffaaa09d9",
                "new_commit_hash": "95e9e92cc",
                "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": 386,
                            "length": 11
                        },
                        "new_range": {
                            "start": 386,
                            "length": 13
                        },
                        "section": "def table_from_frames(xdf, ydf, mdf):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    XYM = (xXYM[0], yXYM[1], mXYM[2])",
                                "type": "context"
                            },
                            {
                                "content": "    domain = Domain(xDomain.attributes, yDomain.class_vars, mDomain.metas)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    index_iter = (filter(lambda ind: ind.startswith('_o'),",
                                "type": "deleted"
                            },
                            {
                                "content": "                         set(df.index[i] for df in dfs))",
                                "type": "deleted"
                            },
                            {
                                "content": "                  for i in range(len(xdf.shape[0])))",
                                "type": "deleted"
                            },
                            {
                                "content": "    ids = (i[0] if len(i) == 1 else Table.new_id()",
                                "type": "deleted"
                            },
                            {
                                "content": "           for i in index_iter)",
                                "type": "deleted"
                            },
                            {
                                "content": "    indexes = [df.index for df in dfs]",
                                "type": "added"
                            },
                            {
                                "content": "    ids = [",
                                "type": "added"
                            },
                            {
                                "content": "        int(x[2:])",
                                "type": "added"
                            },
                            {
                                "content": "        if str(x).startswith(\"_o\") and x[2:].isdigit() and x == y == m",
                                "type": "added"
                            },
                            {
                                "content": "        else Table.new_id()",
                                "type": "added"
                            },
                            {
                                "content": "        for x, y, m in zip(*indexes)",
                                "type": "added"
                            },
                            {
                                "content": "    ]",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    attributes = {}",
                                "type": "context"
                            },
                            {
                                "content": "    W = None",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/pandas_compat.py",
                            "type": "function",
                            "name": "table_from_frames",
                            "content": "def 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    )",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 375,
                            "end_lineno": 413,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# pylint: disable=import-outside-toplevel\nimport unittest\nfrom datetime import date, datetime, timezone\n\nimport numpy as np\nimport pytz\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\nfrom Orange.data.tests.test_variable import TestTimeVariable\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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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.copy()\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.4.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        with self.table.unlocked():\n            df = self.table.X_df\n            df.iloc[0][0] = 0\n        X = self.table.X\n        with self.table.unlocked():\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\nimport unittest\nfrom datetime import date, datetime, timezone\n\nimport numpy as np\nimport pytz\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\nfrom Orange.data.tests.test_variable import TestTimeVariable\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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n\n        x, y, m = table.to_pandas_dfs()\n        new_table = Table.from_pandas_dfs(x, y, m)\n\n        np.testing.assert_array_equal(table.X, new_table.X)\n        np.testing.assert_array_equal(table.Y, new_table.Y)\n        np.testing.assert_array_equal(table.metas, new_table.metas)\n        np.testing.assert_array_equal(table.ids, new_table.ids)\n        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)\n        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)\n        self.assertEqual(table.domain.class_var, new_table.domain.class_var)\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.copy()\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.4.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        with self.table.unlocked():\n            df = self.table.X_df\n            df.iloc[0][0] = 0\n        X = self.table.X\n        with self.table.unlocked():\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": "8fb8191eb",
                "new_commit_hash": "f8649f113",
                "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": 428,
                            "length": 6
                        },
                        "new_range": {
                            "start": 428,
                            "length": 21
                        },
                        "section": "class TestPandasCompat(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            self.assertEqual(len(df), len(table), assert_message)",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertEqual(len(df.columns), len(table.domain.variables), assert_message)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_table_from_frames(self):",
                                "type": "added"
                            },
                            {
                                "content": "        table = Table(\"brown-selected\")  # dataset with all X, Y and metas",
                                "type": "added"
                            },
                            {
                                "content": "        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        x, y, m = table.to_pandas_dfs()",
                                "type": "added"
                            },
                            {
                                "content": "        new_table = Table.from_pandas_dfs(x, y, m)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_array_equal(table.X, new_table.X)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_array_equal(table.Y, new_table.Y)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_array_equal(table.metas, new_table.metas)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_array_equal(table.ids, new_table.ids)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(table.domain.class_var, new_table.domain.class_var)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class TestTablePandas(unittest.TestCase):",
                                "type": "context"
                            },
                            {
                                "content": "    def setUp(self):",
                                "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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n\n        x, y, m = table.to_pandas_dfs()\n        new_table = Table.from_pandas_dfs(x, y, m)\n\n        np.testing.assert_array_equal(table.X, new_table.X)\n        np.testing.assert_array_equal(table.Y, new_table.Y)\n        np.testing.assert_array_equal(table.metas, new_table.metas)\n        np.testing.assert_array_equal(table.ids, new_table.ids)\n        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)\n        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)\n        self.assertEqual(table.domain.class_var, new_table.domain.class_var)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 22,
                            "end_lineno": 444,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/tests/test_pandas.py",
                            "type": "method",
                            "name": "TestPandasCompat.test_table_from_frames",
                            "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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n\n        x, y, m = table.to_pandas_dfs()\n        new_table = Table.from_pandas_dfs(x, y, m)\n\n        np.testing.assert_array_equal(table.X, new_table.X)\n        np.testing.assert_array_equal(table.Y, new_table.Y)\n        np.testing.assert_array_equal(table.metas, new_table.metas)\n        np.testing.assert_array_equal(table.ids, new_table.ids)\n        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)\n        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)\n        self.assertEqual(table.domain.class_var, new_table.domain.class_var)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 431,
                            "end_lineno": 444,
                            "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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n\n        x, y, m = table.to_pandas_dfs()\n        new_table = Table.from_pandas_dfs(x, y, m)\n\n        np.testing.assert_array_equal(table.X, new_table.X)\n        np.testing.assert_array_equal(table.Y, new_table.Y)\n        np.testing.assert_array_equal(table.metas, new_table.metas)\n        np.testing.assert_array_equal(table.ids, new_table.ids)\n        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)\n        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)\n        self.assertEqual(table.domain.class_var, new_table.domain.class_var)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 22,
                                "end_lineno": 444,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "7356c5dd3676eea580c4f2e9e87974efa64bbc60^",
    "new_commit_hash": "7356c5dd3676eea580c4f2e9e87974efa64bbc60",
    "commit_message": "Merge pull request #5620 from PrimozGodec/fix-table_from_frames\n\ntable_from_frames: fix indices parsing",
    "commit_date": "2021-10-25T10:29:50+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "7356c5dd3676eea580c4f2e9e87974efa64bbc60",
    "test_file_codes": [
        "# pylint: disable=import-outside-toplevel\nimport unittest\nfrom datetime import date, datetime, timezone\n\nimport numpy as np\nimport pytz\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\nfrom Orange.data.tests.test_variable import TestTimeVariable\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_object_dtype(self):\n        from Orange.data.pandas_compat import table_to_frame\n\n        domain = Domain([], metas=[ContinuousVariable(\"a\", number_of_decimals=0)])\n        table = Table.from_numpy(\n            domain, np.empty((10, 0)), metas=np.ones((10, 1), dtype=object)\n        )\n\n        df = table_to_frame(table, include_metas=True)\n        self.assertEqual([\"a\"], df.columns)\n        np.testing.assert_array_equal(df[\"a\"].values, np.ones((10,)))\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    def test_table_from_frame_date(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"2017-12-19\")], [pd.Timestamp(\"1724-12-20\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[\"2017-12-19\"], [\"1724-12-20\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame([[date(2017, 12, 19)], [date(1724, 12, 20)], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19\").timestamp()],\n                [pd.Timestamp(\"1724-12-20\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 0)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_time(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [[pd.Timestamp(\"00:00:00.25\")], [pd.Timestamp(\"20:20:20.30\")], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n        df = pd.DataFrame([[\"00:00:00.25\"], [\"20:20:20.30\"], [np.nan]])\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"1970-01-01 00:00:00.25\").timestamp()],\n                [pd.Timestamp(\"1970-01-01 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 0)\n\n    def test_table_from_frame_datetime(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [[\"2017-12-19 00:00:00.50\"], [\"1724-12-20 20:20:20.30\"], [np.nan]]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n        df = pd.DataFrame(\n            [\n                [datetime(2017, 12, 19, 0, 0, 0, 500000)],\n                [datetime(1724, 12, 20, 20, 20, 20, 300000)],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00.50\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20.30\").timestamp()],\n                [np.nan],\n            ],\n        )\n        self.assertEqual(table.domain.variables[0].have_time, 1)\n        self.assertEqual(table.domain.variables[0].have_date, 1)\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n\n    def test_time_variable_compatible(self):\n        from Orange.data.pandas_compat import table_from_frame\n\n        def to_df(val):\n            return pd.DataFrame([[pd.Timestamp(val)]])\n\n        for datestr, timestamp, outstr in TestTimeVariable.TESTS:\n            var = TimeVariable(\"time\")\n            var_parse = var.to_val(datestr)\n            try:\n                pandas_parse = table_from_frame(to_df(datestr)).X[0, 0]\n            except ValueError:\n                # pandas cannot parse some formats in the list skip them\n                continue\n            if not (np.isnan(var_parse) and np.isnan(pandas_parse)):\n                # nan == nan => False\n                self.assertEqual(var_parse, pandas_parse)\n                self.assertEqual(pandas_parse, timestamp)\n\n            self.assertEqual(var.repr_val(var_parse), var.repr_val(var_parse))\n            self.assertEqual(outstr, var.repr_val(var_parse))\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    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n\n        x, y, m = table.to_pandas_dfs()\n        new_table = Table.from_pandas_dfs(x, y, m)\n\n        np.testing.assert_array_equal(table.X, new_table.X)\n        np.testing.assert_array_equal(table.Y, new_table.Y)\n        np.testing.assert_array_equal(table.metas, new_table.metas)\n        np.testing.assert_array_equal(table.ids, new_table.ids)\n        self.assertTupleEqual(table.domain.attributes, new_table.domain.attributes)\n        self.assertTupleEqual(table.domain.metas, new_table.domain.metas)\n        self.assertEqual(table.domain.class_var, new_table.domain.class_var)\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.copy()\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.4.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        with self.table.unlocked():\n            df = self.table.X_df\n            df.iloc[0][0] = 0\n        X = self.table.X\n        with self.table.unlocked():\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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.31.0.dev0+7356c5d to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60\nProcessing dependencies for Orange3==3.31.0.dev0+7356c5d\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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for qtconsole==5.4.4\nBest match: qtconsole 5.4.4\nAdding qtconsole 5.4.4 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for pygments==2.17.2\nBest match: pygments 2.17.2\nAdding pygments 2.17.2 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for httpx==0.19.0\nBest match: httpx 0.19.0\nAdding httpx 0.19.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for jupyter-core==4.12.0\nBest match: jupyter-core 4.12.0\nAdding jupyter-core 4.12.0 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for traitlets==5.9.0\nBest match: traitlets 5.9.0\nAdding traitlets 5.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for ipython-genutils==0.2.0\nBest match: ipython-genutils 0.2.0\nAdding ipython-genutils 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for ipykernel==6.16.2\nBest match: ipykernel 6.16.2\nAdding ipykernel 6.16.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for jupyter-client==7.4.9\nBest match: jupyter-client 7.4.9\nAdding jupyter-client 7.4.9 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.13.7\nBest match: httpcore 0.13.7\nAdding httpcore 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for ipython==7.34.0\nBest match: ipython 7.34.0\nAdding ipython 7.34.0 to easy-install.pth file\nInstalling iptest script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for matplotlib-inline==0.1.6\nBest match: matplotlib-inline 0.1.6\nAdding matplotlib-inline 0.1.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for debugpy==1.7.0\nBest match: debugpy 1.7.0\nAdding debugpy 1.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for tornado==6.2\nBest match: tornado 6.2\nAdding tornado 6.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for entrypoints==0.4\nBest match: entrypoints 0.4\nAdding entrypoints 0.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for h11==0.12.0\nBest match: h11 0.12.0\nAdding h11 0.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for backcall==0.2.0\nBest match: backcall 0.2.0\nAdding backcall 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for pickleshare==0.7.5\nBest match: pickleshare 0.7.5\nAdding pickleshare 0.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.31.0.dev0+7356c5d\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 132ms\nPrepared 18 packages in 10ms\nInstalled 18 packages in 134ms\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 55 packages in 292ms\nInstalled 48 packages in 208ms\n + anyio==3.7.1\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.12.0\n + httpcore==0.13.7\n + httpx==0.19.0\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 59 packages in 390ms\nInstalled 38 packages in 463ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + backcall==0.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + debugpy==1.7.0\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + entrypoints==0.4\n + ipykernel==6.16.2\n + ipython==7.34.0\n + ipython-genutils==0.2.0\n + jedi==0.19.2\n + jupyter-client==7.4.9\n + jupyter-core==4.12.0\n + matplotlib-inline==0.1.6\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + parso==0.8.4\n + pexpect==4.9.0\n + pickleshare==0.7.5\n + platformdirs==4.0.0\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pygments==2.17.2\n + pyqtgraph==0.12.4\n + pyzmq==26.2.0\n + qasync==0.25.0\n + qtconsole==5.4.4\n + qtpy==2.4.2\n + requests-cache==1.1.1\n + tornado==6.2\n + traitlets==5.9.0\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 14ms\nInstalled 2 packages in 98ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 38ms\nInstalled 5 packages in 1.19s\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 2ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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:3427:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3427 |   __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:4883:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4883 |   __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:5629:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5629 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5750:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5750 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5756:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5756 |           __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:7217:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7217 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7874:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7874 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7934:150: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7934 |               __pyx_t_16 = (((*((__pyx_t_5numpy_int32_t const  *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                                      ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60/.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_7356c5dd3676eea580c4f2e9e87974efa64bbc60\nplugins: anyio-3.7.1\ncollected 59 items\n\nr2e_tests/test_1.py ....................F.....s.ssssssss.....s.......... [ 88%]\n.......                                                                  [100%]\n\n=================================== FAILURES ===================================\n_______________ TestPandasCompat.test_table_from_frame_timezones _______________\n\nself = <r2e_tests.test_1.TestPandasCompat testMethod=test_table_from_frame_timezones>\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n>               [np.nan],\n            ],\n        )\nE       AssertionError: \nE       Arrays are not equal\nE       \nE       Mismatched elements: 1 / 3 (33.3%)\nE       Max absolute difference: 2520.\nE       Max relative difference: 3.25902043e-07\nE        x: array([[ 1.513638e+09],\nE              [-7.732382e+09],\nE              [          nan]])\nE        y: array([[ 1.513638e+09],\nE              [-7.732385e+09],\nE              [          nan]])\n\nr2e_tests/test_1.py:364: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date_have_time_in_construct\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_invalid\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_repr\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_timestamp\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_utc\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_readwrite_timevariable\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_remove_deprecated_utc_offset\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_rename\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_repr_value\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_date\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_datetime\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_keep_ids\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_time\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frames\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::TestPandasCompat::test_table_to_frame_object_dtype\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_time_variable_compatible\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:408: Convert all Orange demo dataset. It takes about 5s which is way to slow\nSKIPPED [1] r2e_tests/test_1.py:452: Base class\nSKIPPED [1] r2e_tests/test_1.py:542: Base class\nSKIPPED [1] r2e_tests/test_1.py:504: Base class\nSKIPPED [1] r2e_tests/test_1.py:494: Base class\nSKIPPED [1] r2e_tests/test_1.py:562: Base class\nSKIPPED [1] r2e_tests/test_1.py:602: Base class\nSKIPPED [1] r2e_tests/test_1.py:625: Base class\nSKIPPED [1] r2e_tests/test_1.py:480: Base class\nSKIPPED [1] r2e_tests/test_1.py:687: pandas-dev/pandas#39263\nFAILED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_timezones\n=================== 1 failed, 48 passed, 10 skipped in 2.38s ===================\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_7356c5dd3676eea580c4f2e9e87974efa64bbc60\nplugins: anyio-3.7.1\ncollected 59 items\n\nr2e_tests/test_1.py ....................FF....s.ssssssss.....s.......... [ 88%]\n.......                                                                  [100%]\n\n=================================== FAILURES ===================================\n_______________ TestPandasCompat.test_table_from_frame_timezones _______________\n\nself = <r2e_tests.test_1.TestPandasCompat testMethod=test_table_from_frame_timezones>\n\n    def test_table_from_frame_timezones(self):\n        from Orange.data.pandas_compat import table_from_frame\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(table.domain.variables[0].timezone, timezone.utc)\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00Z\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20Z\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.utc, table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20\").timestamp()],\n                [np.nan],\n            ],\n        )\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.FixedOffset(60), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n                [np.nan],\n            ],\n        )\n    \n        df = pd.DataFrame(\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00\", tz=\"CET\")],\n                [pd.Timestamp(\"1724-12-20 20:20:20\", tz=\"CET\")],\n                [np.nan],\n            ]\n        )\n        table = table_from_frame(df)\n        self.assertEqual(pytz.timezone(\"CET\"), table.domain.variables[0].timezone)\n        np.testing.assert_equal(\n            table.X,\n            [\n                [pd.Timestamp(\"2017-12-19 00:00:00+1\").timestamp()],\n                [pd.Timestamp(\"1724-12-20 20:20:20+1\").timestamp()],\n>               [np.nan],\n            ],\n        )\nE       AssertionError: \nE       Arrays are not equal\nE       \nE       Mismatched elements: 1 / 3 (33.3%)\nE       Max absolute difference: 2520.\nE       Max relative difference: 3.25902043e-07\nE        x: array([[ 1.513638e+09],\nE              [-7.732382e+09],\nE              [          nan]])\nE        y: array([[ 1.513638e+09],\nE              [-7.732385e+09],\nE              [          nan]])\n\nr2e_tests/test_1.py:364: AssertionError\n___________________ TestPandasCompat.test_table_from_frames ____________________\n\nself = <r2e_tests.test_1.TestPandasCompat testMethod=test_table_from_frames>\n\n    def test_table_from_frames(self):\n        table = Table(\"brown-selected\")  # dataset with all X, Y and metas\n        table.ids = np.arange(100, len(table) + 100, 1, dtype=int)\n    \n        x, y, m = table.to_pandas_dfs()\n>       new_table = Table.from_pandas_dfs(x, y, m)\n\nr2e_tests/test_1.py:436: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nOrange/data/table.py:991: in from_pandas_dfs\n    return Orange.data.pandas_compat.table_from_frames(xdf, ydf, mdf)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nxdf =        alpha 0  alpha 7  alpha 14  alpha 21  ...  diau d  diau e  diau f  diau g\n_o100      NaN   -0.023     0.057    ...0.480   0.380\n_o285   -0.093   -0.025     0.086     0.017  ...   0.048   0.157   0.283   0.398\n\n[186 rows x 79 columns]\nydf =        function\n_o100       0.0\n_o101       0.0\n_o102       0.0\n_o103       0.0\n_o104       0.0\n...         ...\n_o281       1.0\n_o282       1.0\n_o283       1.0\n_o284       1.0\n_o285       1.0\n\n[186 rows x 1 columns]\nmdf =           gene\n_o100  YGR270W\n_o101  YIL075C\n_o102  YDL007W\n_o103  YER094C\n_o104  YFR004W\n...        ...\n_o281  YKL141W\n_o282  YDR178W\n_o283  YLL041C\n_o284  YFR033C\n_o285  YOR065W\n\n[186 rows x 1 columns]\n\n    def 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])))\nE       TypeError: object of type 'int' has no len()\n\nOrange/data/pandas_compat.py:391: TypeError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date_have_time_in_construct\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_invalid\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_repr\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_timestamp\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_utc\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_readwrite_timevariable\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_remove_deprecated_utc_offset\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_rename\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_repr_value\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_date\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_datetime\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_keep_ids\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_time\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::TestPandasCompat::test_table_to_frame_object_dtype\nPASSED r2e_tests/test_1.py::TestPandasCompat::test_time_variable_compatible\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:408: Convert all Orange demo dataset. It takes about 5s which is way to slow\nSKIPPED [1] r2e_tests/test_1.py:452: Base class\nSKIPPED [1] r2e_tests/test_1.py:542: Base class\nSKIPPED [1] r2e_tests/test_1.py:504: Base class\nSKIPPED [1] r2e_tests/test_1.py:494: Base class\nSKIPPED [1] r2e_tests/test_1.py:562: Base class\nSKIPPED [1] r2e_tests/test_1.py:602: Base class\nSKIPPED [1] r2e_tests/test_1.py:625: Base class\nSKIPPED [1] r2e_tests/test_1.py:480: Base class\nSKIPPED [1] r2e_tests/test_1.py:687: pandas-dev/pandas#39263\nFAILED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frame_timezones\nFAILED r2e_tests/test_1.py::TestPandasCompat::test_table_from_frames - TypeEr...\n=================== 2 failed, 47 passed, 10 skipped in 2.45s ===================\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:** TypeError Occurs When Parsing Indices in `table_from_frames`

**Description:**
When using the `table_from_frames` function to convert pandas DataFrames into an Orange Table, a `TypeError` is raised due to incorrect parsing of indices. This issue occurs specifically when the function attempts to determine the length of an integer, leading to a failure in processing the table indices.

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

# Sample DataFrames with indices starting with '_o'
xdf = pd.DataFrame({'A': [1, 2]}, index=['_o100', '_o285'])
ydf = pd.DataFrame({'Function': [0.0, 1.0]}, index=['_o100', '_o285'])
mdf = pd.DataFrame({'Gene': ['YGR270W', 'YIL075C']}, index=['_o100', '_o285'])

# Attempt to create an Orange Table
table = Table.from_pandas_dfs(xdf, ydf, mdf)
```

**Actual Behavior:**
Running the above code results in the following error:
```
TypeError: object of type 'int' has no len()
```

**Expected Behavior:**
The `table_from_frames` function should successfully parse the indices from the provided DataFrames and create an Orange Table without errors. The indices should be correctly interpreted to assign unique IDs to each row in the table.

[/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 pandas.core.dtypes.common import is_string_dtype
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):
            # utc=True - to allow different timezones in a series object
            pd.to_datetime(s, infer_datetime_format=True, utc=True)
            return True
    except Exception:  # pylint: disable=broad-except
        pass
    return False


def _convert_datetime(series, var):
    def col_type(dt):
        """Test if is date, time or datetime"""
        dt_nonnat = dt[~pd.isnull(dt)]  # nat == nat is False
        if (dt_nonnat.dt.floor("d") == dt_nonnat).all():
            # all times are 00:00:00.0 - pure date
            return 1, 0
        elif (dt_nonnat.dt.date == pd.Timestamp("now").date()).all():
            # all dates are today's date - pure time
            return 0, 1  # pure time
        else:
            # else datetime
            return 1, 1

    try:
        dt = pd.to_datetime(series)
    except ValueError:
        # series with type object and different timezones will raise a
        # ValueError - normalizing to utc
        dt = pd.to_datetime(series, utc=True)

    # set variable type to date, time or datetime
    var.have_date, var.have_time = col_type(dt)

    if dt.dt.tz is not None:
        # set timezone if available and convert to utc
        var.timezone = dt.dt.tz
        dt = dt.dt.tz_convert("UTC")

    if var.have_time and not var.have_date:
        # if time only measure seconds from midnight - equal to setting date
        # to unix epoch
        return (
            (dt.dt.tz_localize(None) - pd.Timestamp("now").normalize())
            / pd.Timedelta("1s")
        ).values

    return (
        (dt.dt.tz_localize(None) - pd.Timestamp("1970-01-01")) / pd.Timedelta("1s")
    ).values


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 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 = [], [], []
    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_datetime(s):
            var = TimeVariable(str(column))
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(_convert_datetime)
        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)

            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_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)

    # Let the tables share memory with pandas frame
    if XYM[1] is not None and XYM[1].ndim == 2 and XYM[1].shape[1] == 1:
        XYM[1] = XYM[1][:, 0]

    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
        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
        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
            # using pd.isnull since np.isnan fails on array with dtype object
            # which can happen when metas contain column with strings
            if col.number_of_decimals == 0 and not np.any(pd.isnull(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:** TypeError Occurs When Parsing Indices in `table_from_frames`

**Description:**
When using the `table_from_frames` function to convert pandas DataFrames into an Orange Table, a `TypeError` is raised due to incorrect parsing of indices. This issue occurs specifically when the function attempts to determine the length of an integer, leading to a failure in processing the table indices.

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

# Sample DataFrames with indices starting with '_o'
xdf = pd.DataFrame({'A': [1, 2]}, index=['_o100', '_o285'])
ydf = pd.DataFrame({'Function': [0.0, 1.0]}, index=['_o100', '_o285'])
mdf = pd.DataFrame({'Gene': ['YGR270W', 'YIL075C']}, index=['_o100', '_o285'])

# Attempt to create an Orange Table
table = Table.from_pandas_dfs(xdf, ydf, mdf)
```

**Actual Behavior:**
Running the above code results in the following error:
```
TypeError: object of type 'int' has no len()
```

**Expected Behavior:**
The `table_from_frames` function should successfully parse the indices from the provided DataFrames and create an Orange Table without errors. The indices should be correctly interpreted to assign unique IDs to each row in the table.

[/ISSUE]
{
    "TestTimeVariable.test_copy_copies_attributes": "PASSED",
    "TestTimeVariable.test_dont_make_anonymous_variables": "PASSED",
    "TestTimeVariable.test_dont_pickle_anonymous_variables": "PASSED",
    "TestTimeVariable.test_have_date": "PASSED",
    "TestTimeVariable.test_have_date_have_time_in_construct": "PASSED",
    "TestTimeVariable.test_no_date_no_time": "PASSED",
    "TestTimeVariable.test_parse_invalid": "PASSED",
    "TestTimeVariable.test_parse_repr": "PASSED",
    "TestTimeVariable.test_parse_timestamp": "PASSED",
    "TestTimeVariable.test_parse_utc": "PASSED",
    "TestTimeVariable.test_readwrite_timevariable": "PASSED",
    "TestTimeVariable.test_remove_deprecated_utc_offset": "PASSED",
    "TestTimeVariable.test_rename": "PASSED",
    "TestTimeVariable.test_repr_value": "PASSED",
    "TestPandasCompat.test_not_orangedf": "PASSED",
    "TestPandasCompat.test_table_from_frame": "PASSED",
    "TestPandasCompat.test_table_from_frame_date": "PASSED",
    "TestPandasCompat.test_table_from_frame_datetime": "PASSED",
    "TestPandasCompat.test_table_from_frame_keep_ids": "PASSED",
    "TestPandasCompat.test_table_from_frame_time": "PASSED",
    "TestPandasCompat.test_table_from_frames": "PASSED",
    "TestPandasCompat.test_table_to_frame": "PASSED",
    "TestPandasCompat.test_table_to_frame_metas": "PASSED",
    "TestPandasCompat.test_table_to_frame_nans": "PASSED",
    "TestPandasCompat.test_table_to_frame_object_dtype": "PASSED",
    "TestPandasCompat.test_time_variable_compatible": "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",
    "TestPandasCompat.test_table_from_frame_timezones": "FAILED"
}
diff --git a/Orange/data/pandas_compat.py b/Orange/data/pandas_compat.py
index ffaaa09d9..95e9e92cc 100644
--- a/Orange/data/pandas_compat.py
+++ b/Orange/data/pandas_compat.py
@@ -386,11 +386,13 @@ def table_from_frames(xdf, ydf, mdf):
     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)
+    indexes = [df.index for df in dfs]
+    ids = [
+        int(x[2:])
+        if str(x).startswith("_o") and x[2:].isdigit() and x == y == m
+        else Table.new_id()
+        for x, y, m in zip(*indexes)
+    ]
 
     attributes = {}
     W = None

{"Orange/data/pandas_compat.py": "\"\"\"Pandas DataFrame\u2194Table 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            # utc=True - to allow different timezones in a series object\n            pd.to_datetime(s, infer_datetime_format=True, utc=True)\n            return True\n    except Exception:  # pylint: disable=broad-except\n        pass\n    return False\n\n\ndef _convert_datetime(series, var):\n    def col_type(dt):\n        \"\"\"Test if is date, time or datetime\"\"\"\n        dt_nonnat = dt[~pd.isnull(dt)]  # nat == nat is False\n        if (dt_nonnat.dt.floor(\"d\") == dt_nonnat).all():\n            # all times are 00:00:00.0 - pure date\n            return 1, 0\n        elif (dt_nonnat.dt.date == pd.Timestamp(\"now\").date()).all():\n            # all dates are today's date - pure time\n            return 0, 1  # pure time\n        else:\n            # else datetime\n            return 1, 1\n\n    try:\n        dt = pd.to_datetime(series)\n    except ValueError:\n        # series with type object and different timezones will raise a\n        # ValueError - normalizing to utc\n        dt = pd.to_datetime(series, utc=True)\n\n    # set variable type to date, time or datetime\n    var.have_date, var.have_time = col_type(dt)\n\n    if dt.dt.tz is not None:\n        # set timezone if available and convert to utc\n        var.timezone = dt.dt.tz\n        dt = dt.dt.tz_convert(\"UTC\")\n\n    if var.have_time and not var.have_date:\n        # if time only measure seconds from midnight - equal to setting date\n        # to unix epoch\n        return (\n            (dt.dt.tz_localize(None) - pd.Timestamp(\"now\").normalize())\n            / pd.Timedelta(\"1s\")\n        ).values\n\n    return (\n        (dt.dt.tz_localize(None) - pd.Timestamp(\"1970-01-01\")) / pd.Timedelta(\"1s\")\n    ).values\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_datetime(s):\n            var = TimeVariable(str(column))\n            attrs.append(var)\n            Xcols.append(column)\n            Xexpr.append(_convert_datetime)\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_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    # Let the tables share memory with pandas frame\n    if XYM[1] is not None and XYM[1].ndim == 2 and XYM[1].shape[1] == 1:\n        XYM[1] = XYM[1][:, 0]\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            # using pd.isnull since np.isnan fails on array with dtype object\n            # which can happen when metas contain column with strings\n            if col.number_of_decimals == 0 and not np.any(pd.isnull(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:** TypeError Occurs When Parsing Indices in `table_from_frames`

**Description:**
When using the `table_from_frames` function to convert pandas DataFrames into an Orange Table, a `TypeError` is raised due to incorrect parsing of indices. This issue occurs specifically when the function attempts to determine the length of an integer, leading to a failure in processing the table indices.

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

# Sample DataFrames with indices starting with '_o'
xdf = pd.DataFrame({'A': [1, 2]}, index=['_o100', '_o285'])
ydf = pd.DataFrame({'Function': [0.0, 1.0]}, index=['_o100', '_o285'])
mdf = pd.DataFrame({'Gene': ['YGR270W', 'YIL075C']}, index=['_o100', '_o285'])

# Attempt to create an Orange Table
table = Table.from_pandas_dfs(xdf, ydf, mdf)
```

**Actual Behavior:**
Running the above code results in the following error:
```
TypeError: object of type 'int' has no len()
```

**Expected Behavior:**
The `table_from_frames` function should successfully parse the indices from the provided DataFrames and create an Orange Table without errors. The indices should be correctly interpreted to assign unique IDs to each row in the table.

[/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 pandas.core.dtypes.common import is_string_dtype
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):
            # utc=True - to allow different timezones in a series object
            pd.to_datetime(s, infer_datetime_format=True, utc=True)
            return True
    except Exception:  # pylint: disable=broad-except
        pass
    return False


def _convert_datetime(series, var):
    def col_type(dt):
        """Test if is date, time or datetime"""
        dt_nonnat = dt[~pd.isnull(dt)]  # nat == nat is False
        if (dt_nonnat.dt.floor("d") == dt_nonnat).all():
            # all times are 00:00:00.0 - pure date
            return 1, 0
        elif (dt_nonnat.dt.date == pd.Timestamp("now").date()).all():
            # all dates are today's date - pure time
            return 0, 1  # pure time
        else:
            # else datetime
            return 1, 1

    try:
        dt = pd.to_datetime(series)
    except ValueError:
        # series with type object and different timezones will raise a
        # ValueError - normalizing to utc
        dt = pd.to_datetime(series, utc=True)

    # set variable type to date, time or datetime
    var.have_date, var.have_time = col_type(dt)

    if dt.dt.tz is not None:
        # set timezone if available and convert to utc
        var.timezone = dt.dt.tz
        dt = dt.dt.tz_convert("UTC")

    if var.have_time and not var.have_date:
        # if time only measure seconds from midnight - equal to setting date
        # to unix epoch
        return (
            (dt.dt.tz_localize(None) - pd.Timestamp("now").normalize())
            / pd.Timedelta("1s")
        ).values

    return (
        (dt.dt.tz_localize(None) - pd.Timestamp("1970-01-01")) / pd.Timedelta("1s")
    ).values


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 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 = [], [], []
    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_datetime(s):
            var = TimeVariable(str(column))
            attrs.append(var)
            Xcols.append(column)
            Xexpr.append(_convert_datetime)
        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)

            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_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)

    # Let the tables share memory with pandas frame
    if XYM[1] is not None and XYM[1].ndim == 2 and XYM[1].shape[1] == 1:
        XYM[1] = XYM[1][:, 0]

    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
        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
        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
            # using pd.isnull since np.isnan fails on array with dtype object
            # which can happen when metas contain column with strings
            if col.number_of_decimals == 0 and not np.any(pd.isnull(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