File tree 2 files changed +9
-9
lines changed
packages/python/plotly/plotly
tests/test_optional/test_px
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):
1419
1419
else :
1420
1420
# Save precious resources by only interchanging columns that are
1421
1421
# actually going to be plotted.
1422
- necessary_columns = [
1422
+ necessary_columns = {
1423
1423
i for i in args .values () if isinstance (i , str ) and i in columns
1424
- ]
1424
+ }
1425
1425
for field in args :
1426
1426
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 )
1431
1429
args ["data_frame" ] = pd .api .interchange .from_dataframe (
1432
1430
args ["data_frame" ].select_columns_by_name (columns )
1433
1431
)
Original file line number Diff line number Diff line change 8
8
from plotly .express ._core import build_dataframe
9
9
from pandas .testing import assert_frame_equal
10
10
11
+
11
12
# Fixtures
12
13
# --------
13
14
@pytest .fixture
@@ -292,9 +293,10 @@ def __dataframe__(self):
292
293
) as mock_from_dataframe :
293
294
build_dataframe (args , go .Scatter )
294
295
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
+ }
298
300
299
301
args = dict (data_frame = input_dataframe_reduced , color = None )
300
302
with mock .patch (
You can’t perform that action at this time.
0 commit comments