Skip to content

Orange.data.Table.from_pandas_dfs() causes TypeError: object of type 'int' has no len() #5615

@hcchengithub

Description

@hcchengithub

How can we reproduce the problem?

Run this snippet to see the error "TypeError: object of type 'int' has no len()"

import Orange
data = Orange.data.Table("lenses.tab")
dfs = data.to_pandas_dfs() # get xdf ydf mdf to call Orange.data.Table.from_pandas_dfs(xdf, ydf, mdf)
data_from_pandas = Orange.data.Table.from_pandas_dfs(dfs[0],dfs[1],dfs[2])

the result:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_31956/424448060.py in <module>
      2 data = Orange.data.Table("lenses.tab")
      3 dfs = data.to_pandas_dfs()
----> 4 data_from_pandas = Orange.data.Table.from_pandas_dfs(dfs[0],dfs[1],dfs[2])

~\AppData\Local\Continuum\anaconda3\envs\Orange3\lib\site-packages\Orange\data\table.py in from_pandas_dfs(xdf, ydf, mdf)
    760     @staticmethod
    761     def from_pandas_dfs(xdf, ydf, mdf):
--> 762         return Orange.data.pandas_compat.table_from_frames(xdf, ydf, mdf)
    763 
    764     @property

~\AppData\Local\Continuum\anaconda3\envs\Orange3\lib\site-packages\Orange\data\pandas_compat.py in table_from_frames(xdf, ydf, mdf)
    385     index_iter = (filter(lambda ind: ind.startswith('_o'),
    386                          set(df.index[i] for df in dfs))
--> 387                   for i in range(len(xdf.shape[0])))
    388     ids = (i[0] if len(i) == 1 else Table.new_id()
    389            for i in index_iter)

TypeError: object of type 'int' has no len()

What's your environment?

  • Operating system: Windows 10
  • Orange version: 3.30.1
  • How you installed Orange: conda install oragne3

Metadata

Metadata

Assignees

Labels

bug reportBug is reported by user, not yet confirmed by the core team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions