Skip to content

Commit d001a09

Browse files
committed
add changelog entry and test case
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent bc8f920 commit d001a09

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
- Fix issue with creating dendrogram in subplots [[#4411](https://github.com/plotly/plotly.py/pull/4411)],
1010
- Fix issue with px.line not accepting "spline" line shape [[#2812](https://github.com/plotly/plotly.py/issues/2812)]
1111
- Fix KeyError when using column of `pd.Categorical` dtype with unobserved categories [[#4437](https://github.com/plotly/plotly.py/pull/4437)]
12+
- Fix dataframe interchange in case `column_names` returns an unmaterialized object: generator, iterator, etc. [[#4442]](https://github.com/plotly/plotly.py/pull/4442)
1213

1314
## [5.18.0] - 2023-10-25
1415

packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,21 @@ def test_build_df_with_index():
250250
assert_frame_equal(tips.reset_index()[out["data_frame"].columns], out["data_frame"])
251251

252252

253+
@pytest.mark.parametrize("column_names_as_generator", [False, True])
253254
def test_build_df_using_interchange_protocol_mock(
254-
add_interchange_module_for_old_pandas,
255+
add_interchange_module_for_old_pandas, column_names_as_generator
255256
):
256257
class InterchangeDataFrame:
257258
def __init__(self, columns):
258259
self._columns = columns
259260

260-
def column_names(self):
261-
return self._columns
261+
if column_names_as_generator:
262+
def column_names(self):
263+
for col in self._columns:
264+
yield col
265+
else:
266+
def column_names(self):
267+
return self._columns
262268

263269
interchange_dataframe = InterchangeDataFrame(
264270
["petal_width", "sepal_length", "sepal_width"]

0 commit comments

Comments
 (0)