MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_trendline_nan_values

Function test_trendline_nan_values

tests/test_optional/test_px/test_trendline.py:116–138  ·  view source on GitHub ↗
(backend, mode, options)

Source from the content-addressed store, hash-verified

114 ],
115)
116def test_trendline_nan_values(backend, mode, options):
117 start_date = 1970
118 df = (
119 nw.from_native(px.data.gapminder(return_type=backend))
120 .filter(nw.col("continent") == "Oceania")
121 .with_columns(
122 pop=nw.when(nw.col("year") >= start_date)
123 .then(nw.col("pop"))
124 .otherwise(None)
125 )
126 )
127
128 fig = px.scatter(
129 df.to_native(),
130 x="year",
131 y="pop",
132 color="country",
133 trendline=mode,
134 trendline_options=options,
135 )
136 for trendline in fig["data"][1::2]:
137 assert trendline.x[0] >= start_date
138 assert len(trendline.x) == len(trendline.y)
139
140
141def test_ols_trendline_slopes():

Callers

nothing calls this directly

Calls 2

scatterMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected