Skip to content

Commit b6fce18

Browse files
committed
Update _core.py
1 parent e670c4b commit b6fce18

File tree

1 file changed

+10
-2
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+10
-2
lines changed

packages/python/plotly/plotly/express/_core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,9 @@ def build_dataframe(args, constructor):
13311331
elif hasattr(args["data_frame"], "to_pandas"):
13321332
args["data_frame"] = args["data_frame"].to_pandas()
13331333
columns = args["data_frame"].columns
1334+
elif hasattr(args["data_frame"], "toPandas"):
1335+
args["data_frame"] = args["data_frame"].toPandas()
1336+
columns = args["data_frame"].columns
13341337
else:
13351338
args["data_frame"] = pd.DataFrame(args["data_frame"])
13361339
columns = args["data_frame"].columns
@@ -1425,9 +1428,14 @@ def build_dataframe(args, constructor):
14251428
# def __dataframe__(self, ...):
14261429
# if not some_condition:
14271430
# self.to_pandas(...)
1428-
if not hasattr(df_not_pandas, "to_pandas"):
1431+
if not hasattr(df_not_pandas, "to_pandas") or hasattr(
1432+
df_not_pandas, "toPandas"
1433+
):
14291434
raise exc
1430-
args["data_frame"] = df_not_pandas.to_pandas()
1435+
if hasattr(df_not_pandas, "toPandas"):
1436+
args["data_frame"] = df_not_pandas.toPandas()
1437+
else:
1438+
args["data_frame"] = df_not_pandas.to_pandas()
14311439

14321440
df_input = args["data_frame"]
14331441

0 commit comments

Comments
 (0)