File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/python/plotly/plotly/express Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1314,7 +1314,17 @@ def build_dataframe(args, constructor):
13141314 import pandas .api .interchange
13151315
13161316 df_not_pandas = args ["data_frame" ]
1317- df_pandas = pandas .api .interchange .from_dataframe (df_not_pandas )
1317+ try :
1318+ df_pandas = pandas .api .interchange .from_dataframe (df_not_pandas )
1319+ except (ImportError , NotImplementedError ) as exc :
1320+ # temporary workaround; developers of third-party libraries themselves
1321+ # should try a different implementation, if available. For example:
1322+ # def __dataframe__(self, ...):
1323+ # if not some_condition:
1324+ # self.to_pandas(...)
1325+ if not hasattr (df_not_pandas , "to_pandas" ):
1326+ raise exc
1327+ df_not_pandas .to_pandas ()
13181328 args ["data_frame" ] = df_pandas
13191329 elif hasattr (args ["data_frame" ], "to_pandas" ):
13201330 args ["data_frame" ] = args ["data_frame" ].to_pandas ()
You can’t perform that action at this time.
0 commit comments