From 8a5d6327453a8cb2c782a7be2bca3e046fc37c41 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 15 May 2025 15:46:17 +0200 Subject: [PATCH 1/2] Apply ruff/pandas-vet rule PD011 PD011 Use `.to_numpy()` instead of `.values` --- doc/source/reference/random/performance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/reference/random/performance.py b/doc/source/reference/random/performance.py index e4578b7d99e8..87c07c3262a6 100644 --- a/doc/source/reference/random/performance.py +++ b/doc/source/reference/random/performance.py @@ -63,7 +63,7 @@ print(table.to_csv(float_format='%0.1f')) -rel = table.loc[:, ['RandomState']].values @ np.ones( +rel = table.loc[:, ['RandomState']].to_numpy() @ np.ones( (1, table.shape[1])) / table rel.pop('RandomState') rel = rel.T @@ -77,7 +77,7 @@ rows = ['32-bit Unsigned Ints', '64-bit Unsigned Ints', 'Uniforms', 'Normals', 'Exponentials'] xplat = rel.reindex(rows, axis=0) -xplat = 100 * (xplat / xplat.MT19937.values[:, None]) +xplat = 100 * (xplat / xplat.MT19937.to_numpy()[:, None]) overall = np.exp(np.log(xplat).mean(0)) xplat = xplat.T.copy() xplat['Overall'] = overall From 8552f09a557b3692d55ba88507a74375ae9c076c Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 15 May 2025 15:47:38 +0200 Subject: [PATCH 2/2] MNT: Enforce rufr/pandas-vet rules (PD) --- ruff.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruff.toml b/ruff.toml index 60753d5f6325..48d4a27e7633 100644 --- a/ruff.toml +++ b/ruff.toml @@ -27,6 +27,7 @@ extend-select = [ "TID", "FLY", "I", + "PD", "E", "W", "PGH", @@ -37,6 +38,7 @@ ignore = [ "C408", # Unnecessary `dict()` call (rewrite as a literal) "ISC002", # Implicitly concatenated string literals over multiple lines "PIE790", # Unnecessary `pass` statement + "PD901", # Avoid using the generic variable name `df` for DataFrames "E241", # Multiple spaces after comma "E265", # Block comment should start with `# ` "E266", # Too many leading `#` before block comment