title
stringclasses
1 value
text
stringlengths
30
426k
id
stringlengths
27
30
asv_bench/benchmarks/timeseries.py/SortIndex/setup class SortIndex: def setup(self, monotonic): N = 10**5 idx = date_range(start="1/1/2000", periods=N, freq="s") self.s = Series(np.random.randn(N), index=idx) if not monotonic: self.s = self.s.sample(frac=1)
negative_train_query0_01198
asv_bench/benchmarks/timeseries.py/SortIndex/time_sort_index class SortIndex: def time_sort_index(self, monotonic): self.s.sort_index()
negative_train_query0_01199
asv_bench/benchmarks/timeseries.py/SortIndex/time_get_slice class SortIndex: def time_get_slice(self, monotonic): self.s[:10000]
negative_train_query0_01200
asv_bench/benchmarks/timeseries.py/Lookup/setup class Lookup: def setup(self): N = 1500000 rng = date_range(start="1/1/2000", periods=N, freq="s") self.ts = Series(1, index=rng) self.lookup_val = rng[N // 2]
negative_train_query0_01201
asv_bench/benchmarks/timeseries.py/Lookup/time_lookup_and_cleanup class Lookup: def time_lookup_and_cleanup(self): self.ts[self.lookup_val] self.ts.index._cleanup()
negative_train_query0_01202
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/setup class DatetimeAccessor: def setup(self, tz): N = 100000 self.series = Series(date_range(start="1/1/2000", periods=N, freq="min", tz=tz))
negative_train_query0_01203
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor class DatetimeAccessor: def time_dt_accessor(self, tz): self.series.dt
negative_train_query0_01204
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_normalize class DatetimeAccessor: def time_dt_accessor_normalize(self, tz): self.series.dt.normalize()
negative_train_query0_01205
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_month_name class DatetimeAccessor: def time_dt_accessor_month_name(self, tz): self.series.dt.month_name()
negative_train_query0_01206
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_day_name class DatetimeAccessor: def time_dt_accessor_day_name(self, tz): self.series.dt.day_name()
negative_train_query0_01207
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_time class DatetimeAccessor: def time_dt_accessor_time(self, tz): self.series.dt.time
negative_train_query0_01208
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_date class DatetimeAccessor: def time_dt_accessor_date(self, tz): self.series.dt.date
negative_train_query0_01209
asv_bench/benchmarks/timeseries.py/DatetimeAccessor/time_dt_accessor_year class DatetimeAccessor: def time_dt_accessor_year(self, tz): self.series.dt.year
negative_train_query0_01210
asv_bench/benchmarks/pandas_vb_common.py/setup def setup(*args, **kwargs): # This function just needs to be imported into each benchmark file to # set up the random seed before each function. # https://asv.readthedocs.io/en/latest/writing_benchmarks.html np.random.seed(1234)
negative_train_query0_01211
asv_bench/benchmarks/pandas_vb_common.py/BaseIO/remove class BaseIO: def remove(self, f): """Remove created files""" try: os.remove(f) except OSError: # On Windows, attempting to remove a file that is in use # causes an exception to be raised pass
negative_train_query0_01212
asv_bench/benchmarks/pandas_vb_common.py/BaseIO/teardown class BaseIO: def teardown(self, *args, **kwargs): self.remove(self.fname)
negative_train_query0_01213
asv_bench/benchmarks/reshape.py/Melt/setup class Melt: def setup(self, dtype): self.df = DataFrame( np.random.randn(100_000, 3), columns=["A", "B", "C"], dtype=dtype ) self.df["id1"] = pd.Series(np.random.randint(0, 10, 10000)) self.df["id2"] = pd.Series(np.random.randint(100...
negative_train_query0_01214
asv_bench/benchmarks/reshape.py/Melt/time_melt_dataframe class Melt: def time_melt_dataframe(self, dtype): melt(self.df, id_vars=["id1", "id2"])
negative_train_query0_01215
asv_bench/benchmarks/reshape.py/Pivot/setup class Pivot: def setup(self): N = 10000 index = date_range("1/1/2000", periods=N, freq="h") data = { "value": np.random.randn(N * 50), "variable": np.arange(50).repeat(N), "date": np.tile(index.values, 50), }...
negative_train_query0_01216
asv_bench/benchmarks/reshape.py/Pivot/time_reshape_pivot_time_series class Pivot: def time_reshape_pivot_time_series(self): self.df.pivot(index="date", columns="variable", values="value")
negative_train_query0_01217
asv_bench/benchmarks/reshape.py/SimpleReshape/setup class SimpleReshape: def setup(self): arrays = [np.arange(100).repeat(100), np.roll(np.tile(np.arange(100), 100), 25)] index = MultiIndex.from_arrays(arrays) self.df = DataFrame(np.random.randn(10000, 4), index=index) self.udf = self.df...
negative_train_query0_01218
asv_bench/benchmarks/reshape.py/SimpleReshape/time_stack class SimpleReshape: def time_stack(self): self.udf.stack()
negative_train_query0_01219
asv_bench/benchmarks/reshape.py/SimpleReshape/time_unstack class SimpleReshape: def time_unstack(self): self.df.unstack(1)
negative_train_query0_01220
asv_bench/benchmarks/reshape.py/ReshapeExtensionDtype/setup class ReshapeExtensionDtype: def setup(self, dtype): lev = pd.Index(list("ABCDEFGHIJ")) ri = pd.Index(range(1000)) mi = MultiIndex.from_product([lev, ri], names=["foo", "bar"]) index = date_range("2016-01-01", periods=10000, fr...
negative_train_query0_01221
asv_bench/benchmarks/reshape.py/ReshapeExtensionDtype/time_stack class ReshapeExtensionDtype: def time_stack(self, dtype): self.df.stack()
negative_train_query0_01222
asv_bench/benchmarks/reshape.py/ReshapeExtensionDtype/time_unstack_fast class ReshapeExtensionDtype: def time_unstack_fast(self, dtype): # last level -> doesn't have to make copies self.ser.unstack("bar")
negative_train_query0_01223
asv_bench/benchmarks/reshape.py/ReshapeExtensionDtype/time_unstack_slow class ReshapeExtensionDtype: def time_unstack_slow(self, dtype): # first level -> must make copies self.ser.unstack("foo")
negative_train_query0_01224
asv_bench/benchmarks/reshape.py/ReshapeExtensionDtype/time_transpose class ReshapeExtensionDtype: def time_transpose(self, dtype): self.df.T
negative_train_query0_01225
asv_bench/benchmarks/reshape.py/ReshapeMaskedArrayDtype/setup class ReshapeMaskedArrayDtype: def setup(self, dtype): lev = pd.Index(list("ABCDEFGHIJ")) ri = pd.Index(range(1000)) mi = MultiIndex.from_product([lev, ri], names=["foo", "bar"]) values = np.random.randn(10_000).astype(int) ...
negative_train_query0_01226
asv_bench/benchmarks/reshape.py/Unstack/setup class Unstack: def setup(self, dtype): m = 100 n = 1000 levels = np.arange(m) index = MultiIndex.from_product([levels] * 2) columns = np.arange(n) if dtype == "int": values = np.arange(m * m * n).reshape(m * m, n)...
negative_train_query0_01227
asv_bench/benchmarks/reshape.py/Unstack/time_full_product class Unstack: def time_full_product(self, dtype): self.df.unstack()
negative_train_query0_01228
asv_bench/benchmarks/reshape.py/Unstack/time_without_last_row class Unstack: def time_without_last_row(self, dtype): self.df2.unstack()
negative_train_query0_01229
asv_bench/benchmarks/reshape.py/SparseIndex/setup class SparseIndex: def setup(self): NUM_ROWS = 1000 self.df = DataFrame( { "A": np.random.randint(50, size=NUM_ROWS), "B": np.random.randint(50, size=NUM_ROWS), "C": np.random.randint(-10, 10, s...
negative_train_query0_01230
asv_bench/benchmarks/reshape.py/SparseIndex/time_unstack class SparseIndex: def time_unstack(self): self.df.unstack()
negative_train_query0_01231
asv_bench/benchmarks/reshape.py/WideToLong/setup class WideToLong: def setup(self): nyrs = 20 nidvars = 20 N = 5000 self.letters = list("ABCD") yrvars = [ letter + str(num) for letter, num in product(self.letters, range(1, nyrs + 1)) ] colu...
negative_train_query0_01232
asv_bench/benchmarks/reshape.py/WideToLong/time_wide_to_long_big class WideToLong: def time_wide_to_long_big(self): wide_to_long(self.df, self.letters, i="id", j="year")
negative_train_query0_01233
asv_bench/benchmarks/reshape.py/PivotTable/setup class PivotTable: def setup(self): N = 100000 fac1 = np.array(["A", "B", "C"], dtype="O") fac2 = np.array(["one", "two"], dtype="O") ind1 = np.random.randint(0, 3, size=N) ind2 = np.random.randint(0, 2, size=N) self.df = Da...
negative_train_query0_01234
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table class PivotTable: def time_pivot_table(self): self.df.pivot_table(index="key1", columns=["key2", "key3"])
negative_train_query0_01235
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table_agg class PivotTable: def time_pivot_table_agg(self): self.df.pivot_table( index="key1", columns=["key2", "key3"], aggfunc=["sum", "mean"] )
negative_train_query0_01236
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table_margins class PivotTable: def time_pivot_table_margins(self): self.df.pivot_table(index="key1", columns=["key2", "key3"], margins=True)
negative_train_query0_01237
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table_categorical class PivotTable: def time_pivot_table_categorical(self): self.df2.pivot_table( index="col1", values="col3", columns="col2", aggfunc="sum", fill_value=0 )
negative_train_query0_01238
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table_categorical_observed class PivotTable: def time_pivot_table_categorical_observed(self): self.df2.pivot_table( index="col1", values="col3", columns="col2", aggfunc="sum", fill_value=0, ...
negative_train_query0_01239
asv_bench/benchmarks/reshape.py/PivotTable/time_pivot_table_margins_only_column class PivotTable: def time_pivot_table_margins_only_column(self): self.df.pivot_table(columns=["key1", "key2", "key3"], margins=True)
negative_train_query0_01240
asv_bench/benchmarks/reshape.py/Crosstab/setup class Crosstab: def setup(self): N = 100000 fac1 = np.array(["A", "B", "C"], dtype="O") fac2 = np.array(["one", "two"], dtype="O") self.ind1 = np.random.randint(0, 3, size=N) self.ind2 = np.random.randint(0, 2, size=N) self.v...
negative_train_query0_01241
asv_bench/benchmarks/reshape.py/Crosstab/time_crosstab class Crosstab: def time_crosstab(self): pd.crosstab(self.vec1, self.vec2)
negative_train_query0_01242
asv_bench/benchmarks/reshape.py/Crosstab/time_crosstab_values class Crosstab: def time_crosstab_values(self): pd.crosstab(self.vec1, self.vec2, values=self.ind1, aggfunc="sum")
negative_train_query0_01243
asv_bench/benchmarks/reshape.py/Crosstab/time_crosstab_normalize class Crosstab: def time_crosstab_normalize(self): pd.crosstab(self.vec1, self.vec2, normalize=True)
negative_train_query0_01244
asv_bench/benchmarks/reshape.py/Crosstab/time_crosstab_normalize_margins class Crosstab: def time_crosstab_normalize_margins(self): pd.crosstab(self.vec1, self.vec2, normalize=True, margins=True)
negative_train_query0_01245
asv_bench/benchmarks/reshape.py/GetDummies/setup class GetDummies: def setup(self): categories = list(string.ascii_letters[:12]) s = pd.Series( np.random.choice(categories, size=1000000), dtype=CategoricalDtype(categories), ) self.s = s
negative_train_query0_01246
asv_bench/benchmarks/reshape.py/GetDummies/time_get_dummies_1d class GetDummies: def time_get_dummies_1d(self): pd.get_dummies(self.s, sparse=False)
negative_train_query0_01247
asv_bench/benchmarks/reshape.py/GetDummies/time_get_dummies_1d_sparse class GetDummies: def time_get_dummies_1d_sparse(self): pd.get_dummies(self.s, sparse=True)
negative_train_query0_01248
asv_bench/benchmarks/reshape.py/Cut/setup class Cut: def setup(self, bins): N = 10**5 self.int_series = pd.Series(np.arange(N).repeat(5)) self.float_series = pd.Series(np.random.randn(N).repeat(5)) self.timedelta_series = pd.Series( np.random.randint(N, size=N), dtype="timede...
negative_train_query0_01249
asv_bench/benchmarks/reshape.py/Cut/time_cut_int class Cut: def time_cut_int(self, bins): pd.cut(self.int_series, bins)
negative_train_query0_01250
asv_bench/benchmarks/reshape.py/Cut/time_cut_float class Cut: def time_cut_float(self, bins): pd.cut(self.float_series, bins)
negative_train_query0_01251
asv_bench/benchmarks/reshape.py/Cut/time_cut_timedelta class Cut: def time_cut_timedelta(self, bins): pd.cut(self.timedelta_series, bins)
negative_train_query0_01252
asv_bench/benchmarks/reshape.py/Cut/time_cut_datetime class Cut: def time_cut_datetime(self, bins): pd.cut(self.datetime_series, bins)
negative_train_query0_01253
asv_bench/benchmarks/reshape.py/Cut/time_qcut_int class Cut: def time_qcut_int(self, bins): pd.qcut(self.int_series, bins)
negative_train_query0_01254
asv_bench/benchmarks/reshape.py/Cut/time_qcut_float class Cut: def time_qcut_float(self, bins): pd.qcut(self.float_series, bins)
negative_train_query0_01255
asv_bench/benchmarks/reshape.py/Cut/time_qcut_timedelta class Cut: def time_qcut_timedelta(self, bins): pd.qcut(self.timedelta_series, bins)
negative_train_query0_01256
asv_bench/benchmarks/reshape.py/Cut/time_qcut_datetime class Cut: def time_qcut_datetime(self, bins): pd.qcut(self.datetime_series, bins)
negative_train_query0_01257
asv_bench/benchmarks/reshape.py/Cut/time_cut_interval class Cut: def time_cut_interval(self, bins): # GH 27668 pd.cut(self.int_series, self.interval_bins)
negative_train_query0_01258
asv_bench/benchmarks/reshape.py/Cut/peakmem_cut_interval class Cut: def peakmem_cut_interval(self, bins): # GH 27668 pd.cut(self.int_series, self.interval_bins)
negative_train_query0_01259
asv_bench/benchmarks/reshape.py/Explode/setup class Explode: def setup(self, n_rows, max_list_length): data = [np.arange(np.random.randint(max_list_length)) for _ in range(n_rows)] self.series = pd.Series(data)
negative_train_query0_01260
asv_bench/benchmarks/reshape.py/Explode/time_explode class Explode: def time_explode(self, n_rows, max_list_length): self.series.explode()
negative_train_query0_01261
asv_bench/benchmarks/index_cached_properties.py/IndexCache/setup class IndexCache: def setup(self, index_type): N = 10**5 if index_type == "MultiIndex": self.idx = pd.MultiIndex.from_product( [pd.date_range("1/1/2000", freq="min", periods=N // 2), ["a", "b"]] ) ...
negative_train_query0_01262
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_values class IndexCache: def time_values(self, index_type): self.idx._values
negative_train_query0_01263
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_shape class IndexCache: def time_shape(self, index_type): self.idx.shape
negative_train_query0_01264
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_is_monotonic_decreasing class IndexCache: def time_is_monotonic_decreasing(self, index_type): self.idx.is_monotonic_decreasing
negative_train_query0_01265
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_is_monotonic_increasing class IndexCache: def time_is_monotonic_increasing(self, index_type): self.idx.is_monotonic_increasing
negative_train_query0_01266
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_is_unique class IndexCache: def time_is_unique(self, index_type): self.idx.is_unique
negative_train_query0_01267
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_engine class IndexCache: def time_engine(self, index_type): self.idx._engine
negative_train_query0_01268
asv_bench/benchmarks/index_cached_properties.py/IndexCache/time_inferred_type class IndexCache: def time_inferred_type(self, index_type): self.idx.inferred_type
negative_train_query0_01269
asv_bench/benchmarks/arithmetic.py/IntFrameWithScalar/setup class IntFrameWithScalar: def setup(self, dtype, scalar, op): arr = np.random.randn(20000, 100) self.df = DataFrame(arr.astype(dtype))
negative_train_query0_01270
asv_bench/benchmarks/arithmetic.py/IntFrameWithScalar/time_frame_op_with_scalar class IntFrameWithScalar: def time_frame_op_with_scalar(self, dtype, scalar, op): op(self.df, scalar)
negative_train_query0_01271
asv_bench/benchmarks/arithmetic.py/OpWithFillValue/setup class OpWithFillValue: def setup(self): # GH#31300 arr = np.arange(10**6) df = DataFrame({"A": arr}) ser = df["A"] self.df = df self.ser = ser
negative_train_query0_01272
asv_bench/benchmarks/arithmetic.py/OpWithFillValue/time_frame_op_with_fill_value_no_nas class OpWithFillValue: def time_frame_op_with_fill_value_no_nas(self): self.df.add(self.df, fill_value=4)
negative_train_query0_01273
asv_bench/benchmarks/arithmetic.py/OpWithFillValue/time_series_op_with_fill_value_no_nas class OpWithFillValue: def time_series_op_with_fill_value_no_nas(self): self.ser.add(self.ser, fill_value=4)
negative_train_query0_01274
asv_bench/benchmarks/arithmetic.py/MixedFrameWithSeriesAxis/setup class MixedFrameWithSeriesAxis: def setup(self, opname): arr = np.arange(10**6).reshape(1000, -1) df = DataFrame(arr) df["C"] = 1.0 self.df = df self.ser = df[0] self.row = df.iloc[0]
negative_train_query0_01275
asv_bench/benchmarks/arithmetic.py/MixedFrameWithSeriesAxis/time_frame_op_with_series_axis0 class MixedFrameWithSeriesAxis: def time_frame_op_with_series_axis0(self, opname): getattr(self.df, opname)(self.ser, axis=0)
negative_train_query0_01276
asv_bench/benchmarks/arithmetic.py/MixedFrameWithSeriesAxis/time_frame_op_with_series_axis1 class MixedFrameWithSeriesAxis: def time_frame_op_with_series_axis1(self, opname): getattr(operator, opname)(self.df, self.ser)
negative_train_query0_01277
asv_bench/benchmarks/arithmetic.py/FrameWithFrameWide/setup class FrameWithFrameWide: def setup(self, op, shape): # we choose dtypes so as to make the blocks # a) not perfectly match between right and left # b) appreciably bigger than single columns n_rows, n_cols = shape if o...
negative_train_query0_01278
asv_bench/benchmarks/arithmetic.py/FrameWithFrameWide/time_op_different_blocks class FrameWithFrameWide: def time_op_different_blocks(self, op, shape): # blocks (and dtypes) are not aligned op(self.left, self.right)
negative_train_query0_01279
asv_bench/benchmarks/arithmetic.py/FrameWithFrameWide/time_op_same_blocks class FrameWithFrameWide: def time_op_same_blocks(self, op, shape): # blocks (and dtypes) are aligned op(self.left, self.left)
negative_train_query0_01280
asv_bench/benchmarks/arithmetic.py/Ops/setup class Ops: def setup(self, use_numexpr, threads): self.df = DataFrame(np.random.randn(20000, 100)) self.df2 = DataFrame(np.random.randn(20000, 100)) if threads != "default": expr.set_numexpr_threads(threads) if not use_numexpr: ...
negative_train_query0_01281
asv_bench/benchmarks/arithmetic.py/Ops/time_frame_add class Ops: def time_frame_add(self, use_numexpr, threads): self.df + self.df2
negative_train_query0_01282
asv_bench/benchmarks/arithmetic.py/Ops/time_frame_mult class Ops: def time_frame_mult(self, use_numexpr, threads): self.df * self.df2
negative_train_query0_01283
asv_bench/benchmarks/arithmetic.py/Ops/time_frame_multi_and class Ops: def time_frame_multi_and(self, use_numexpr, threads): self.df[(self.df > 0) & (self.df2 > 0)]
negative_train_query0_01284
asv_bench/benchmarks/arithmetic.py/Ops/time_frame_comparison class Ops: def time_frame_comparison(self, use_numexpr, threads): self.df > self.df2
negative_train_query0_01285
asv_bench/benchmarks/arithmetic.py/Ops/teardown class Ops: def teardown(self, use_numexpr, threads): expr.set_use_numexpr(True) expr.set_numexpr_threads()
negative_train_query0_01286
asv_bench/benchmarks/arithmetic.py/Ops2/setup class Ops2: def setup(self): N = 10**3 self.df = DataFrame(np.random.randn(N, N)) self.df2 = DataFrame(np.random.randn(N, N)) self.df_int = DataFrame( np.random.randint( np.iinfo(np.int16).min, np.iinfo(np.int16)....
negative_train_query0_01287
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_float_div class Ops2: def time_frame_float_div(self): self.df // self.df2
negative_train_query0_01288
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_float_div_by_zero class Ops2: def time_frame_float_div_by_zero(self): self.df / 0
negative_train_query0_01289
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_float_floor_by_zero class Ops2: def time_frame_float_floor_by_zero(self): self.df // 0
negative_train_query0_01290
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_int_div_by_zero class Ops2: def time_frame_int_div_by_zero(self): self.df_int / 0
negative_train_query0_01291
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_int_mod class Ops2: def time_frame_int_mod(self): self.df_int % self.df2_int
negative_train_query0_01292
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_float_mod class Ops2: def time_frame_float_mod(self): self.df % self.df2
negative_train_query0_01293
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_dot class Ops2: def time_frame_dot(self): self.df.dot(self.df2)
negative_train_query0_01294
asv_bench/benchmarks/arithmetic.py/Ops2/time_series_dot class Ops2: def time_series_dot(self): self.s.dot(self.s)
negative_train_query0_01295
asv_bench/benchmarks/arithmetic.py/Ops2/time_frame_series_dot class Ops2: def time_frame_series_dot(self): self.df.dot(self.s)
negative_train_query0_01296
asv_bench/benchmarks/arithmetic.py/Timeseries/setup class Timeseries: def setup(self, tz): N = 10**6 halfway = (N // 2) - 1 self.s = Series(date_range("20010101", periods=N, freq="min", tz=tz)) self.ts = self.s[halfway] self.s2 = Series(date_range("20010101", periods=N, freq="s"...
negative_train_query0_01297