diff --git a/CHANGELOG.md b/CHANGELOG.md index 02955f43edc..a98864ddda1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Introduce group attributes for `scatter` trace i.e. `alignmentgroup`, `offsetgroup`, `scattermode` and `scattergap` [[#6381](https://github.com/plotly/plotly.js/pull/6381)], this feature was anonymously sponsored: thank you to our sponsor! - Add `marker.cornerradius` attribute to `treemap` trace [[#6351](https://github.com/plotly/plotly.js/pull/6351)] +### Fixed + - Fixed the usage of sume deprecated NumPy types which were removed in NumPy 1.24 [[#3997](https://github.com/plotly/plotly.py/pull/3997)] ## [5.11.0] - 2022-10-27 diff --git a/packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py b/packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py index f6d3983c123..07f61155a56 100644 --- a/packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py +++ b/packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py @@ -58,7 +58,7 @@ def test_acceptance_min_max(val, validator_min_max): @pytest.mark.parametrize( - "val", [-1.01, -10, 2.1, 3, np.iinfo(np.int).max, np.iinfo(np.int).min] + "val", [-1.01, -10, 2.1, 3, np.iinfo(int).max, np.iinfo(int).min] ) def test_rejection_min_max(val, validator_min_max): with pytest.raises(ValueError) as validation_failure: diff --git a/packages/python/plotly/plotly/express/imshow_utils.py b/packages/python/plotly/plotly/express/imshow_utils.py index 5f5cc0c0926..5b02a5907b6 100644 --- a/packages/python/plotly/plotly/express/imshow_utils.py +++ b/packages/python/plotly/plotly/express/imshow_utils.py @@ -21,7 +21,6 @@ _integer_ranges = {t: (np.iinfo(t).min, np.iinfo(t).max) for t in _integer_types} dtype_range = { np.bool_: (False, True), - np.bool8: (False, True), np.float16: (-1, 1), np.float32: (-1, 1), np.float64: (-1, 1), diff --git a/packages/python/plotly/plotly/figure_factory/_streamline.py b/packages/python/plotly/plotly/figure_factory/_streamline.py index 54076da5d44..108b20c5d3a 100644 --- a/packages/python/plotly/plotly/figure_factory/_streamline.py +++ b/packages/python/plotly/plotly/figure_factory/_streamline.py @@ -180,11 +180,11 @@ def value_at(self, a, xi, yi): Set up for RK4 function, based on Bokeh's streamline code """ if isinstance(xi, np.ndarray): - self.x = xi.astype(np.int) - self.y = yi.astype(np.int) + self.x = xi.astype(int) + self.y = yi.astype(int) else: - self.val_x = np.int(xi) - self.val_y = np.int(yi) + self.val_x = int(xi) + self.val_y = int(yi) a00 = a[self.val_y, self.val_x] a01 = a[self.val_y, self.val_x + 1] a10 = a[self.val_y + 1, self.val_x] diff --git a/packages/python/plotly/plotly/figure_factory/_violin.py b/packages/python/plotly/plotly/figure_factory/_violin.py index a2398304b28..c420990a7fe 100644 --- a/packages/python/plotly/plotly/figure_factory/_violin.py +++ b/packages/python/plotly/plotly/figure_factory/_violin.py @@ -16,7 +16,7 @@ def calc_stats(data): """ Calculate statistics for use in violin plot. """ - x = np.asarray(data, np.float) + x = np.asarray(data, float) vals_min = np.min(x) vals_max = np.max(x) q2 = np.percentile(x, 50, interpolation="linear") @@ -160,7 +160,7 @@ def violinplot(vals, fillcolor="#1f77b4", rugplot=True): """ Refer to FigureFactory.create_violin() for docstring. """ - vals = np.asarray(vals, np.float) + vals = np.asarray(vals, float) # summary statistics vals_min = calc_stats(vals)["min"] vals_max = calc_stats(vals)["max"] @@ -231,7 +231,7 @@ def violin_no_colorscale( ) color_index = 0 for k, gr in enumerate(group_name): - vals = np.asarray(gb.get_group(gr)[data_header], np.float) + vals = np.asarray(gb.get_group(gr)[data_header], float) if color_index >= len(colors): color_index = 0 plot_data, plot_xrange = violinplot( @@ -319,7 +319,7 @@ def violin_colorscale( min_value = min(group_stats_values) for k, gr in enumerate(group_name): - vals = np.asarray(gb.get_group(gr)[data_header], np.float) + vals = np.asarray(gb.get_group(gr)[data_header], float) # find intermediate color from colorscale intermed = (group_stats[gr] - min_value) / (max_value - min_value) @@ -411,7 +411,7 @@ def violin_dict( ) for k, gr in enumerate(group_name): - vals = np.asarray(gb.get_group(gr)[data_header], np.float) + vals = np.asarray(gb.get_group(gr)[data_header], float) plot_data, plot_xrange = violinplot(vals, fillcolor=colors[gr], rugplot=rugplot) layout = graph_objs.Layout() diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py index d4b33db2e40..09f1ae1d90f 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py @@ -9,7 +9,7 @@ from plotly.express.imshow_utils import rescale_intensity img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]]], dtype=np.uint8) -img_gray = np.arange(100, dtype=np.float).reshape((10, 10)) +img_gray = np.arange(100, dtype=float).reshape((10, 10)) def decode_image_string(image_string): @@ -47,7 +47,7 @@ def test_automatic_zmax_from_dtype(): dtypes_dict = { np.uint8: 2**8 - 1, np.uint16: 2**16 - 1, - np.float: 1, + float: 1, bool: 255, } for key, val in dtypes_dict.items(): diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 1ee61ab5354..1bd33252425 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -414,8 +414,8 @@ def test_numpy_integer_import(self): import plotly.graph_objects as go from plotly.subplots import make_subplots - indices_rows = np.array([1], dtype=np.int) - indices_cols = np.array([1], dtype=np.int) + indices_rows = np.array([1], dtype=int) + indices_cols = np.array([1], dtype=int) fig = make_subplots(rows=1, cols=1) fig.add_trace(go.Scatter(y=[1]), row=indices_rows[0], col=indices_cols[0])