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):
1327
1327
1328
1328
df_not_pandas = args ["data_frame" ]
1329
1329
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 ())
1331
1335
needs_interchanging = True
1332
1336
elif hasattr (args ["data_frame" ], "to_pandas" ):
1333
1337
args ["data_frame" ] = args ["data_frame" ].to_pandas ()
You can’t perform that action at this time.
0 commit comments