File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
packages/python/plotly/plotly
tests/test_optional/test_px Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1419,15 +1419,13 @@ def build_dataframe(args, constructor):
14191419 else :
14201420 # Save precious resources by only interchanging columns that are
14211421 # actually going to be plotted.
1422- necessary_columns = [
1422+ necessary_columns = {
14231423 i for i in args .values () if isinstance (i , str ) and i in columns
1424- ]
1424+ }
14251425 for field in args :
14261426 if args [field ] is not None and field in array_attrables :
1427- necessary_columns .extend (
1428- [i for i in args [field ] if i in columns ]
1429- )
1430- columns = list (dict .fromkeys (necessary_columns ))
1427+ necessary_columns .update (i for i in args [field ] if i in columns )
1428+ columns = list (necessary_columns )
14311429 args ["data_frame" ] = pd .api .interchange .from_dataframe (
14321430 args ["data_frame" ].select_columns_by_name (columns )
14331431 )
Original file line number Diff line number Diff line change 88from plotly .express ._core import build_dataframe
99from pandas .testing import assert_frame_equal
1010
11+
1112# Fixtures
1213# --------
1314@pytest .fixture
@@ -292,9 +293,10 @@ def __dataframe__(self):
292293 ) as mock_from_dataframe :
293294 build_dataframe (args , go .Scatter )
294295 mock_from_dataframe .assert_called_once_with (interchange_dataframe_reduced )
295- interchange_dataframe .select_columns_by_name .assert_called_with (
296- ["petal_width" , "sepal_length" ]
297- )
296+ assert set (interchange_dataframe .select_columns_by_name .call_args .args [0 ]) == {
297+ "petal_width" ,
298+ "sepal_length" ,
299+ }
298300
299301 args = dict (data_frame = input_dataframe_reduced , color = None )
300302 with mock .patch (
You can’t perform that action at this time.
0 commit comments