Skip to content

Commit 419331c

Browse files
⬆️ UPGRADE: Autoupdate pre-commit config (#45752)
Co-authored-by: MarcoGorelli <MarcoGorelli@users.noreply.github.com>
1 parent da0156a commit 419331c

File tree

135 files changed

+644
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+644
-647
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44
autofix_prs: false
55
repos:
66
- repo: https://github.com/MarcoGorelli/absolufy-imports
7-
rev: v0.3.0
7+
rev: v0.3.1
88
hooks:
99
- id: absolufy-imports
1010
files: ^pandas/
@@ -16,7 +16,7 @@ repos:
1616
pass_filenames: true
1717
require_serial: false
1818
- repo: https://github.com/python/black
19-
rev: 21.12b0
19+
rev: 22.1.0
2020
hooks:
2121
- id: black
2222
- repo: https://github.com/codespell-project/codespell

asv_bench/benchmarks/algorithms.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Factorize:
3434
param_names = ["unique", "sort", "dtype"]
3535

3636
def setup(self, unique, sort, dtype):
37-
N = 10 ** 5
37+
N = 10**5
3838
string_index = tm.makeStringIndex(N)
3939
string_arrow = None
4040
if dtype == "string[pyarrow]":
@@ -74,7 +74,7 @@ class Duplicated:
7474
param_names = ["unique", "keep", "dtype"]
7575

7676
def setup(self, unique, keep, dtype):
77-
N = 10 ** 5
77+
N = 10**5
7878
data = {
7979
"int": pd.Index(np.arange(N), dtype="int64"),
8080
"uint": pd.Index(np.arange(N), dtype="uint64"),
@@ -97,7 +97,7 @@ def time_duplicated(self, unique, keep, dtype):
9797

9898
class Hashing:
9999
def setup_cache(self):
100-
N = 10 ** 5
100+
N = 10**5
101101

102102
df = pd.DataFrame(
103103
{
@@ -145,7 +145,7 @@ class Quantile:
145145
param_names = ["quantile", "interpolation", "dtype"]
146146

147147
def setup(self, quantile, interpolation, dtype):
148-
N = 10 ** 5
148+
N = 10**5
149149
data = {
150150
"int": np.arange(N),
151151
"uint": np.arange(N).astype(np.uint64),
@@ -158,7 +158,7 @@ def time_quantile(self, quantile, interpolation, dtype):
158158

159159

160160
class SortIntegerArray:
161-
params = [10 ** 3, 10 ** 5]
161+
params = [10**3, 10**5]
162162

163163
def setup(self, N):
164164
data = np.arange(N, dtype=float)

asv_bench/benchmarks/algos/isin.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setup(self, dtype):
4949

5050
elif dtype in ["category[object]", "category[int]"]:
5151
# Note: sizes are different in this case than others
52-
n = 5 * 10 ** 5
52+
n = 5 * 10**5
5353
sample_size = 100
5454

5555
arr = list(np.random.randint(0, n // 10, size=n))
@@ -174,7 +174,7 @@ class IsinWithArange:
174174

175175
def setup(self, dtype, M, offset_factor):
176176
offset = int(M * offset_factor)
177-
tmp = Series(np.random.randint(offset, M + offset, 10 ** 6))
177+
tmp = Series(np.random.randint(offset, M + offset, 10**6))
178178
self.series = tmp.astype(dtype)
179179
self.values = np.arange(M).astype(dtype)
180180

@@ -191,8 +191,8 @@ class IsInFloat64:
191191
param_names = ["dtype", "title"]
192192

193193
def setup(self, dtype, title):
194-
N_many = 10 ** 5
195-
N_few = 10 ** 6
194+
N_many = 10**5
195+
N_few = 10**6
196196
self.series = Series([1, 2], dtype=dtype)
197197

198198
if title == "many_different_values":
@@ -240,10 +240,10 @@ class IsInForObjects:
240240
param_names = ["series_type", "vals_type"]
241241

242242
def setup(self, series_type, vals_type):
243-
N_many = 10 ** 5
243+
N_many = 10**5
244244

245245
if series_type == "nans":
246-
ser_vals = np.full(10 ** 4, np.nan)
246+
ser_vals = np.full(10**4, np.nan)
247247
elif series_type == "short":
248248
ser_vals = np.arange(2)
249249
elif series_type == "long":
@@ -254,7 +254,7 @@ def setup(self, series_type, vals_type):
254254
self.series = Series(ser_vals).astype(object)
255255

256256
if vals_type == "nans":
257-
values = np.full(10 ** 4, np.nan)
257+
values = np.full(10**4, np.nan)
258258
elif vals_type == "short":
259259
values = np.arange(2)
260260
elif vals_type == "long":
@@ -277,7 +277,7 @@ class IsInLongSeriesLookUpDominates:
277277
param_names = ["dtype", "MaxNumber", "series_type"]
278278

279279
def setup(self, dtype, MaxNumber, series_type):
280-
N = 10 ** 7
280+
N = 10**7
281281

282282
if series_type == "random_hits":
283283
array = np.random.randint(0, MaxNumber, N)
@@ -304,15 +304,15 @@ class IsInLongSeriesValuesDominate:
304304
param_names = ["dtype", "series_type"]
305305

306306
def setup(self, dtype, series_type):
307-
N = 10 ** 7
307+
N = 10**7
308308

309309
if series_type == "random":
310310
vals = np.random.randint(0, 10 * N, N)
311311
if series_type == "monotone":
312312
vals = np.arange(N)
313313

314314
self.values = vals.astype(dtype.lower())
315-
M = 10 ** 6 + 1
315+
M = 10**6 + 1
316316
self.series = Series(np.arange(M)).astype(dtype)
317317

318318
def time_isin(self, dtypes, series_type):

asv_bench/benchmarks/arithmetic.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def time_frame_op_with_scalar(self, dtype, scalar, op):
5959
class OpWithFillValue:
6060
def setup(self):
6161
# GH#31300
62-
arr = np.arange(10 ** 6)
62+
arr = np.arange(10**6)
6363
df = DataFrame({"A": arr})
6464
ser = df["A"]
6565

@@ -93,7 +93,7 @@ class MixedFrameWithSeriesAxis:
9393
param_names = ["opname"]
9494

9595
def setup(self, opname):
96-
arr = np.arange(10 ** 6).reshape(1000, -1)
96+
arr = np.arange(10**6).reshape(1000, -1)
9797
df = DataFrame(arr)
9898
df["C"] = 1.0
9999
self.df = df
@@ -201,7 +201,7 @@ def teardown(self, use_numexpr, threads):
201201

202202
class Ops2:
203203
def setup(self):
204-
N = 10 ** 3
204+
N = 10**3
205205
self.df = DataFrame(np.random.randn(N, N))
206206
self.df2 = DataFrame(np.random.randn(N, N))
207207

@@ -258,7 +258,7 @@ class Timeseries:
258258
param_names = ["tz"]
259259

260260
def setup(self, tz):
261-
N = 10 ** 6
261+
N = 10**6
262262
halfway = (N // 2) - 1
263263
self.s = Series(date_range("20010101", periods=N, freq="T", tz=tz))
264264
self.ts = self.s[halfway]
@@ -280,7 +280,7 @@ def time_timestamp_ops_diff_with_shift(self, tz):
280280

281281
class IrregularOps:
282282
def setup(self):
283-
N = 10 ** 5
283+
N = 10**5
284284
idx = date_range(start="1/1/2000", periods=N, freq="s")
285285
s = Series(np.random.randn(N), index=idx)
286286
self.left = s.sample(frac=1)
@@ -304,7 +304,7 @@ class CategoricalComparisons:
304304
param_names = ["op"]
305305

306306
def setup(self, op):
307-
N = 10 ** 5
307+
N = 10**5
308308
self.cat = pd.Categorical(list("aabbcd") * N, ordered=True)
309309

310310
def time_categorical_op(self, op):
@@ -317,7 +317,7 @@ class IndexArithmetic:
317317
param_names = ["dtype"]
318318

319319
def setup(self, dtype):
320-
N = 10 ** 6
320+
N = 10**6
321321
indexes = {"int": "makeIntIndex", "float": "makeFloatIndex"}
322322
self.index = getattr(tm, indexes[dtype])(N)
323323

@@ -343,7 +343,7 @@ class NumericInferOps:
343343
param_names = ["dtype"]
344344

345345
def setup(self, dtype):
346-
N = 5 * 10 ** 5
346+
N = 5 * 10**5
347347
self.df = DataFrame(
348348
{"A": np.arange(N).astype(dtype), "B": np.arange(N).astype(dtype)}
349349
)
@@ -367,7 +367,7 @@ def time_modulo(self, dtype):
367367
class DateInferOps:
368368
# from GH 7332
369369
def setup_cache(self):
370-
N = 5 * 10 ** 5
370+
N = 5 * 10**5
371371
df = DataFrame({"datetime64": np.arange(N).astype("datetime64[ms]")})
372372
df["timedelta"] = df["datetime64"] - df["datetime64"]
373373
return df
@@ -388,7 +388,7 @@ class AddOverflowScalar:
388388
param_names = ["scalar"]
389389

390390
def setup(self, scalar):
391-
N = 10 ** 6
391+
N = 10**6
392392
self.arr = np.arange(N)
393393

394394
def time_add_overflow_scalar(self, scalar):
@@ -397,7 +397,7 @@ def time_add_overflow_scalar(self, scalar):
397397

398398
class AddOverflowArray:
399399
def setup(self):
400-
N = 10 ** 6
400+
N = 10**6
401401
self.arr = np.arange(N)
402402
self.arr_rev = np.arange(-N, 0)
403403
self.arr_mixed = np.array([1, -1]).repeat(N / 2)

asv_bench/benchmarks/categoricals.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class Constructor:
2121
def setup(self):
22-
N = 10 ** 5
22+
N = 10**5
2323
self.categories = list("abcde")
2424
self.cat_idx = pd.Index(self.categories)
2525
self.values = np.tile(self.categories, N)
@@ -71,16 +71,16 @@ def time_existing_series(self):
7171

7272
class AsType:
7373
def setup(self):
74-
N = 10 ** 5
74+
N = 10**5
7575

7676
random_pick = np.random.default_rng().choice
7777

7878
categories = {
7979
"str": list(string.ascii_letters),
80-
"int": np.random.randint(2 ** 16, size=154),
80+
"int": np.random.randint(2**16, size=154),
8181
"float": sys.maxsize * np.random.random((38,)),
8282
"timestamp": [
83-
pd.Timestamp(x, unit="s") for x in np.random.randint(2 ** 18, size=578)
83+
pd.Timestamp(x, unit="s") for x in np.random.randint(2**18, size=578)
8484
],
8585
}
8686

@@ -112,7 +112,7 @@ def astype_datetime(self):
112112

113113
class Concat:
114114
def setup(self):
115-
N = 10 ** 5
115+
N = 10**5
116116
self.s = pd.Series(list("aabbcd") * N).astype("category")
117117

118118
self.a = pd.Categorical(list("aabbcd") * N)
@@ -148,7 +148,7 @@ class ValueCounts:
148148
param_names = ["dropna"]
149149

150150
def setup(self, dropna):
151-
n = 5 * 10 ** 5
151+
n = 5 * 10**5
152152
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
153153
self.ts = pd.Series(arr).astype("category")
154154

@@ -166,7 +166,7 @@ def time_rendering(self):
166166

167167
class SetCategories:
168168
def setup(self):
169-
n = 5 * 10 ** 5
169+
n = 5 * 10**5
170170
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
171171
self.ts = pd.Series(arr).astype("category")
172172

@@ -176,7 +176,7 @@ def time_set_categories(self):
176176

177177
class RemoveCategories:
178178
def setup(self):
179-
n = 5 * 10 ** 5
179+
n = 5 * 10**5
180180
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
181181
self.ts = pd.Series(arr).astype("category")
182182

@@ -186,7 +186,7 @@ def time_remove_categories(self):
186186

187187
class Rank:
188188
def setup(self):
189-
N = 10 ** 5
189+
N = 10**5
190190
ncats = 100
191191

192192
self.s_str = pd.Series(tm.makeCategoricalIndex(N, ncats)).astype(str)
@@ -241,7 +241,7 @@ def time_categorical_series_is_monotonic_decreasing(self):
241241

242242
class Contains:
243243
def setup(self):
244-
N = 10 ** 5
244+
N = 10**5
245245
self.ci = tm.makeCategoricalIndex(N)
246246
self.c = self.ci.values
247247
self.key = self.ci.categories[0]
@@ -259,7 +259,7 @@ class CategoricalSlicing:
259259
param_names = ["index"]
260260

261261
def setup(self, index):
262-
N = 10 ** 6
262+
N = 10**6
263263
categories = ["a", "b", "c"]
264264
values = [0] * N + [1] * N + [2] * N
265265
if index == "monotonic_incr":
@@ -295,7 +295,7 @@ def time_getitem_bool_array(self, index):
295295

296296
class Indexing:
297297
def setup(self):
298-
N = 10 ** 5
298+
N = 10**5
299299
self.index = pd.CategoricalIndex(range(N), range(N))
300300
self.series = pd.Series(range(N), index=self.index).sort_index()
301301
self.category = self.index[500]
@@ -327,7 +327,7 @@ def time_sort_values(self):
327327

328328
class SearchSorted:
329329
def setup(self):
330-
N = 10 ** 5
330+
N = 10**5
331331
self.ci = tm.makeCategoricalIndex(N).sort_values()
332332
self.c = self.ci.values
333333
self.key = self.ci.categories[1]

asv_bench/benchmarks/ctors.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def setup(self, data_fmt, with_index, dtype):
7676
raise NotImplementedError(
7777
"Series constructors do not support using generators with indexes"
7878
)
79-
N = 10 ** 4
79+
N = 10**4
8080
if dtype == "float":
8181
arr = np.random.randn(N)
8282
else:
@@ -90,7 +90,7 @@ def time_series_constructor(self, data_fmt, with_index, dtype):
9090

9191
class SeriesDtypesConstructors:
9292
def setup(self):
93-
N = 10 ** 4
93+
N = 10**4
9494
self.arr = np.random.randn(N)
9595
self.arr_str = np.array(["foo", "bar", "baz"], dtype=object)
9696
self.s = Series(
@@ -114,7 +114,7 @@ def time_dtindex_from_index_with_series(self):
114114

115115
class MultiIndexConstructor:
116116
def setup(self):
117-
N = 10 ** 4
117+
N = 10**4
118118
self.iterables = [tm.makeStringIndex(N), range(20)]
119119

120120
def time_multiindex_from_iterables(self):

asv_bench/benchmarks/eval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def teardown(self, engine, threads):
4343

4444
class Query:
4545
def setup(self):
46-
N = 10 ** 6
46+
N = 10**6
4747
halfway = (N // 2) - 1
4848
index = pd.date_range("20010101", periods=N, freq="T")
4949
s = pd.Series(index)

asv_bench/benchmarks/frame_ctor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class FromDictwithTimestamp:
7777
param_names = ["offset"]
7878

7979
def setup(self, offset):
80-
N = 10 ** 3
80+
N = 10**3
8181
idx = date_range(Timestamp("1/1/1900"), freq=offset, periods=N)
8282
df = DataFrame(np.random.randn(N, 10), index=idx)
8383
self.d = df.to_dict()

0 commit comments

Comments
 (0)