We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 63b9ac5 commit bc8f920Copy full SHA for bc8f920
packages/python/plotly/plotly/express/_core.py
@@ -1327,7 +1327,11 @@ def build_dataframe(args, constructor):
1327
1328
df_not_pandas = args["data_frame"]
1329
args["data_frame"] = df_not_pandas.__dataframe__()
1330
- columns = args["data_frame"].column_names()
+ # 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())
1335
needs_interchanging = True
1336
elif hasattr(args["data_frame"], "to_pandas"):
1337
args["data_frame"] = args["data_frame"].to_pandas()
0 commit comments