Skip to content

Commit 499e2fa

Browse files
committed
bump version, use numpy for range
1 parent fc74b2e commit 499e2fa

13 files changed

+25
-17
lines changed

Diff for: packages/python/plotly/optional-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ipython
3939

4040
## pandas deps for some matplotlib functionality ##
4141
pandas
42-
narwhals>=1.13.2
42+
narwhals>=1.13.3
4343

4444
## scipy deps for some FigureFactory functions ##
4545
scipy

Diff for: packages/python/plotly/plotly/express/_core.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -1417,9 +1417,11 @@ def process_args_into_dataframe(
14171417
raise NotImplementedError(msg)
14181418

14191419
if ranges:
1420+
import numpy as np
1421+
14201422
range_series = nw.new_series(
14211423
name="__placeholder__",
1422-
values=range(length),
1424+
values=np.arange(length),
14231425
native_namespace=native_namespace,
14241426
)
14251427
df_output.update(
@@ -2161,10 +2163,16 @@ def process_dataframe_pie(args, trace_patch):
21612163
uniques = df.get_column(names).unique(maintain_order=True).to_list()
21622164
order = [x for x in OrderedDict.fromkeys(list(order_in) + uniques) if x in uniques]
21632165

2164-
# Original implementation: args["data_frame"] = df.set_index(names).loc[order].reset_index()
2165-
# However we do not have a way to custom sort a dataframe in narwhals.
2166-
args["data_frame"] = nw.concat(
2167-
[df.filter(nw.col(names) == value) for value in order], how="vertical"
2166+
# Sort args['data_frame'] by column 'b' according to order `order`.
2167+
token = nw.generate_temporary_column_name(8, df.columns)
2168+
args["data_frame"] = (
2169+
df.with_columns(
2170+
nw.col("b")
2171+
.replace_strict(order, range(len(order)), return_dtype=nw.UInt32)
2172+
.alias(token)
2173+
)
2174+
.sort(token)
2175+
.drop(token)
21682176
)
21692177
return args, trace_patch
21702178

Diff for: packages/python/plotly/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
###################################################
77

88
## dataframe agnostic layer ##
9-
narwhals>=1.13.2
9+
narwhals>=1.13.3

Diff for: packages/python/plotly/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def run(self):
603603
data_files=[
604604
("etc/jupyter/nbconfig/notebook.d", ["jupyterlab-plotly.json"]),
605605
],
606-
install_requires=["narwhals>=1.13.2", "packaging"],
606+
install_requires=["narwhals>=1.13.3", "packaging"],
607607
zip_safe=False,
608608
cmdclass=dict(
609609
build_py=js_prerelease(versioneer_cmds["build_py"]),
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.25.1
22
pytest==7.4.4
3-
narwhals>=1.13.2
3+
narwhals>=1.13.3

Diff for: packages/python/plotly/test_requirements/requirements_310_optional.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ kaleido
2121
orjson==3.8.12
2222
polars[timezone]
2323
pyarrow
24-
narwhals>=1.13.2
24+
narwhals>=1.13.3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.25.1
22
pytest==7.4.4
3-
narwhals>=1.13.2
3+
narwhals>=1.13.3

Diff for: packages/python/plotly/test_requirements/requirements_311_optional.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ kaleido
2121
orjson==3.8.12
2222
polars[timezone]
2323
pyarrow
24-
narwhals>=1.13.2
24+
narwhals>=1.13.3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.25.1
22
pytest==8.1.1
3-
narwhals>=1.13.2
3+
narwhals>=1.13.3

Diff for: packages/python/plotly/test_requirements/requirements_38_optional.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ psutil==5.7.0
2121
kaleido
2222
polars[timezone]
2323
pyarrow
24-
narwhals>=1.13.2
24+
narwhals>=1.13.3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.25.1
22
pytest==6.2.3
3-
narwhals>=1.13.2
3+
narwhals>=1.13.3

Diff for: packages/python/plotly/test_requirements/requirements_39_optional.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ kaleido
2222
orjson==3.8.12
2323
polars[timezone]
2424
pyarrow
25-
narwhals>=1.13.2
25+
narwhals>=1.13.3

Diff for: packages/python/plotly/test_requirements/requirements_39_pandas_2_optional.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ vaex
2222
pydantic<=1.10.11 # for vaex, see https://github.com/vaexio/vaex/issues/2384
2323
polars[timezone]
2424
pyarrow
25-
narwhals>=1.13.2
25+
narwhals>=1.13.3

0 commit comments

Comments
 (0)