-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: relax numpy<=2.0.0
constraint
#3504
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Didn't find any The same changes would need to be made for "examples_arguments_syntax" equivalent files. diff --git a/tests/examples_methods_syntax/layered_histogram.py b/tests/examples_methods_syntax/layered_histogram.py
index 62c7dccf..ed418b05 100644
--- a/tests/examples_methods_syntax/layered_histogram.py
+++ b/tests/examples_methods_syntax/layered_histogram.py
@@ -7,13 +7,13 @@ This example shows how to use opacity to make a layered histogram in Altair.
import pandas as pd
import altair as alt
import numpy as np
-np.random.seed(42)
+np.random.seed(42) # noqa: NPY002
# Generating Data
source = pd.DataFrame({
- 'Trial A': np.random.normal(0, 0.8, 1000),
- 'Trial B': np.random.normal(-2, 1, 1000),
- 'Trial C': np.random.normal(3, 2, 1000)
+ 'Trial A': np.random.normal(0, 0.8, 1000), # noqa: NPY002
+ 'Trial B': np.random.normal(-2, 1, 1000), # noqa: NPY002
+ 'Trial C': np.random.normal(3, 2, 1000) # noqa: NPY002
})
alt.Chart(source).transform_fold(
diff --git a/tests/examples_methods_syntax/multiline_tooltip.py b/tests/examples_methods_syntax/multiline_tooltip.py
index 12ac92bf..1801d370 100644
--- a/tests/examples_methods_syntax/multiline_tooltip.py
+++ b/tests/examples_methods_syntax/multiline_tooltip.py
@@ -14,10 +14,10 @@ import altair as alt
import pandas as pd
import numpy as np
-np.random.seed(42)
+np.random.seed(42) # noqa: NPY002
columns = ["A", "B", "C"]
source = pd.DataFrame(
- np.cumsum(np.random.randn(100, 3), 0).round(2),
+ np.cumsum(np.random.randn(100, 3), 0).round(2), # noqa: NPY002
columns=columns, index=pd.RangeIndex(100, name="x")
)
source = source.reset_index().melt("x", var_name="category", value_name="y")
diff --git a/tests/examples_methods_syntax/multiline_tooltip_standard.py b/tests/examples_methods_syntax/multiline_tooltip_standard.py
index 990aa201..f908ee0a 100644
--- a/tests/examples_methods_syntax/multiline_tooltip_standard.py
+++ b/tests/examples_methods_syntax/multiline_tooltip_standard.py
@@ -10,10 +10,10 @@ import altair as alt
import pandas as pd
import numpy as np
-np.random.seed(42)
+np.random.seed(42) # noqa: NPY002
columns = ["A", "B", "C"]
source = pd.DataFrame(
- np.cumsum(np.random.randn(100, 3), 0).round(2),
+ np.cumsum(np.random.randn(100, 3), 0).round(2), # noqa: NPY002
columns=columns, index=pd.RangeIndex(100, name="x"),
)
source = source.reset_index().melt("x", var_name="category", value_name="y")
diff --git a/tests/examples_methods_syntax/scatter_with_layered_histogram.py b/tests/examples_methods_syntax/scatter_with_layered_histogram.py
index 2cec7590..0c25fd02 100644
--- a/tests/examples_methods_syntax/scatter_with_layered_histogram.py
+++ b/tests/examples_methods_syntax/scatter_with_layered_histogram.py
@@ -16,13 +16,13 @@ import numpy as np
source = pd.DataFrame({
'gender': ['M']*1000 + ['F']*1000,
'height':np.concatenate((
- np.random.normal(69, 7, 1000), np.random.normal(64, 6, 1000)
+ np.random.normal(69, 7, 1000), np.random.normal(64, 6, 1000) # noqa: NPY002
)),
'weight': np.concatenate((
- np.random.normal(195.8, 144, 1000), np.random.normal(167, 100, 1000)
+ np.random.normal(195.8, 144, 1000), np.random.normal(167, 100, 1000) # noqa: NPY002
)),
'age': np.concatenate((
- np.random.normal(45, 8, 1000), np.random.normal(51, 6, 1000)
+ np.random.normal(45, 8, 1000), np.random.normal(51, 6, 1000) # noqa: NPY002
))
})
diff --git a/tests/examples_methods_syntax/select_detail.py b/tests/examples_methods_syntax/select_detail.py
index 58bdb9df..0fe447fe 100644
--- a/tests/examples_methods_syntax/select_detail.py
+++ b/tests/examples_methods_syntax/select_detail.py
@@ -15,7 +15,7 @@ import altair as alt
import pandas as pd
import numpy as np
-np.random.seed(0)
+np.random.seed(0) # noqa: NPY002
n_objects = 20
n_times = 50
@@ -23,12 +23,12 @@ n_times = 50
# Create one (x, y) pair of metadata per object
locations = pd.DataFrame({
'id': range(n_objects),
- 'x': np.random.randn(n_objects),
- 'y': np.random.randn(n_objects)
+ 'x': np.random.randn(n_objects), # noqa: NPY002
+ 'y': np.random.randn(n_objects) # noqa: NPY002
})
# Create a 50-element time-series for each object
-timeseries = pd.DataFrame(np.random.randn(n_times, n_objects).cumsum(0),
+timeseries = pd.DataFrame(np.random.randn(n_times, n_objects).cumsum(0), # noqa: NPY002
columns=locations['id'],
index=pd.RangeIndex(0, n_times, name='time'))
diff --git a/tests/examples_methods_syntax/simple_scatter_with_errorbars.py b/tests/examples_methods_syntax/simple_scatter_with_errorbars.py
index 434e6adc..bcf8c28b 100644
--- a/tests/examples_methods_syntax/simple_scatter_with_errorbars.py
+++ b/tests/examples_methods_syntax/simple_scatter_with_errorbars.py
@@ -9,9 +9,9 @@ import pandas as pd
import numpy as np
# generate some data points with uncertainties
-np.random.seed(0)
+np.random.seed(0) # noqa: NPY002
x = [1, 2, 3, 4, 5]
-y = np.random.normal(10, 0.5, size=len(x))
+y = np.random.normal(10, 0.5, size=len(x)) # noqa: NPY002
yerr = 0.2
# set up data frame
diff --git a/tests/examples_methods_syntax/stem_and_leaf.py b/tests/examples_methods_syntax/stem_and_leaf.py
index 9436d8eb..72c940a9 100644
--- a/tests/examples_methods_syntax/stem_and_leaf.py
+++ b/tests/examples_methods_syntax/stem_and_leaf.py
@@ -7,10 +7,10 @@ This example shows how to make a stem and leaf plot.
import altair as alt
import pandas as pd
import numpy as np
-np.random.seed(42)
+np.random.seed(42) # noqa: NPY002
# Generating random data
-source = pd.DataFrame({'samples': np.random.normal(50, 15, 100).astype(int).astype(str)})
+source = pd.DataFrame({'samples': np.random.normal(50, 15, 100).astype(int).astype(str)}) # noqa: NPY002
# Splitting stem and leaf
source['stem'] = source['samples'].str[:-1]
|
Thanks! It looks good as-is. Thanks for pushing! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up: #3438
Most of the
numpy
usage is within the test examples, which is not run throughruff
.Applying all of
NPY
only required one fix, so AFAIKaltair
is compatible withNumPy 2.0
.Moving out of draft after checking for issues in
r"tests/examples_.+_syntax/*.py"
Edit: See #3504 (comment)