File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/python/plotly/plotly/express Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1327,7 +1327,11 @@ def build_dataframe(args, constructor):
13271327
13281328 df_not_pandas = args ["data_frame" ]
13291329 args ["data_frame" ] = df_not_pandas .__dataframe__ ()
1330- columns = args ["data_frame" ].column_names ()
1330+ # According interchange protocol: `def column_names(self) -> Iterable[str]:`
1331+ # so this function can return for example a generator.
1332+ # The easiest way is to convert `columns` to `pandas.Index` so that the
1333+ # type is similar to the types in other code branches.
1334+ columns = pd .Index (args ["data_frame" ].column_names ())
13311335 needs_interchanging = True
13321336 elif hasattr (args ["data_frame" ], "to_pandas" ):
13331337 args ["data_frame" ] = args ["data_frame" ].to_pandas ()
You can’t perform that action at this time.
0 commit comments