title
stringclasses
1 value
text
stringlengths
30
426k
id
stringlengths
27
30
asv_bench/benchmarks/indexing.py/DataFrameStringIndexing/time_at_setitem class DataFrameStringIndexing: def time_at_setitem(self): self.df.at[self.idx_scalar, self.col_scalar] = 0.0
negative_train_query0_00698
asv_bench/benchmarks/indexing.py/DataFrameStringIndexing/time_getitem_scalar class DataFrameStringIndexing: def time_getitem_scalar(self): self.df[self.col_scalar][self.idx_scalar]
negative_train_query0_00699
asv_bench/benchmarks/indexing.py/DataFrameStringIndexing/time_boolean_rows class DataFrameStringIndexing: def time_boolean_rows(self): self.df[self.bool_indexer]
negative_train_query0_00700
asv_bench/benchmarks/indexing.py/DataFrameStringIndexing/time_boolean_rows_object class DataFrameStringIndexing: def time_boolean_rows_object(self): self.df[self.bool_obj_indexer]
negative_train_query0_00701
asv_bench/benchmarks/indexing.py/DataFrameStringIndexing/time_boolean_rows_boolean class DataFrameStringIndexing: def time_boolean_rows_boolean(self): self.df[self.boolean_indexer]
negative_train_query0_00702
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/setup class DataFrameNumericIndexing: def setup(self, dtype, index_structure): N = 10**5 indices = { "unique_monotonic_inc": Index(range(N), dtype=dtype), "nonunique_monotonic_inc": Index( list(range(55)) + [54] + list(range(55, N - 1)), dtype=dtype ), } self.idx_dupe = np.array(range(30)) * 99 self.df = DataFrame(np.random.randn(N, 5), index=indices[index_structure]) self.df_dup = concat([self.df, 2 * self.df, 3 * self.df]) self.bool_indexer = [True] * (N // 2) + [False] * (N - N // 2)
negative_train_query0_00703
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/time_iloc_dups class DataFrameNumericIndexing: def time_iloc_dups(self, index, index_structure): self.df_dup.iloc[self.idx_dupe]
negative_train_query0_00704
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/time_loc_dups class DataFrameNumericIndexing: def time_loc_dups(self, index, index_structure): self.df_dup.loc[self.idx_dupe]
negative_train_query0_00705
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/time_iloc class DataFrameNumericIndexing: def time_iloc(self, index, index_structure): self.df.iloc[:100, 0]
negative_train_query0_00706
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/time_loc class DataFrameNumericIndexing: def time_loc(self, index, index_structure): self.df.loc[:100, 0]
negative_train_query0_00707
asv_bench/benchmarks/indexing.py/DataFrameNumericIndexing/time_bool_indexer class DataFrameNumericIndexing: def time_bool_indexer(self, index, index_structure): self.df[self.bool_indexer]
negative_train_query0_00708
asv_bench/benchmarks/indexing.py/Take/setup class Take: def setup(self, index): N = 100000 indexes = { "int": Index(np.arange(N), dtype=np.int64), "datetime": date_range("2011-01-01", freq="s", periods=N), } index = indexes[index] self.s = Series(np.random.rand(N), index=index) self.indexer = np.random.randint(0, N, size=N)
negative_train_query0_00709
asv_bench/benchmarks/indexing.py/Take/time_take class Take: def time_take(self, index): self.s.take(self.indexer)
negative_train_query0_00710
asv_bench/benchmarks/indexing.py/MultiIndexing/setup class MultiIndexing: def setup(self, unique_levels): self.nlevels = 2 if unique_levels: mi = MultiIndex.from_arrays([range(1000000)] * self.nlevels) else: mi = MultiIndex.from_product([range(1000)] * self.nlevels) self.df = DataFrame(np.random.randn(len(mi)), index=mi) self.tgt_slice = slice(200, 800) self.tgt_null_slice = slice(None) self.tgt_list = list(range(0, 1000, 10)) self.tgt_scalar = 500 bool_indexer = np.zeros(len(mi), dtype=np.bool_) bool_indexer[slice(0, len(mi), 100)] = True self.tgt_bool_indexer = bool_indexer
negative_train_query0_00711
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_partial_key_slice class MultiIndexing: def time_loc_partial_key_slice(self, unique_levels): self.df.loc[self.tgt_slice, :]
negative_train_query0_00712
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_partial_key_null_slice class MultiIndexing: def time_loc_partial_key_null_slice(self, unique_levels): self.df.loc[self.tgt_null_slice, :]
negative_train_query0_00713
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_partial_key_list class MultiIndexing: def time_loc_partial_key_list(self, unique_levels): self.df.loc[self.tgt_list, :]
negative_train_query0_00714
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_partial_key_scalar class MultiIndexing: def time_loc_partial_key_scalar(self, unique_levels): self.df.loc[self.tgt_scalar, :]
negative_train_query0_00715
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_partial_key_bool_indexer class MultiIndexing: def time_loc_partial_key_bool_indexer(self, unique_levels): self.df.loc[self.tgt_bool_indexer, :]
negative_train_query0_00716
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_all_slices class MultiIndexing: def time_loc_all_slices(self, unique_levels): target = tuple([self.tgt_slice] * self.nlevels) self.df.loc[target, :]
negative_train_query0_00717
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_all_null_slices class MultiIndexing: def time_loc_all_null_slices(self, unique_levels): target = tuple([self.tgt_null_slice] * self.nlevels) self.df.loc[target, :]
negative_train_query0_00718
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_all_lists class MultiIndexing: def time_loc_all_lists(self, unique_levels): target = tuple([self.tgt_list] * self.nlevels) self.df.loc[target, :]
negative_train_query0_00719
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_all_scalars class MultiIndexing: def time_loc_all_scalars(self, unique_levels): target = tuple([self.tgt_scalar] * self.nlevels) self.df.loc[target, :]
negative_train_query0_00720
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_all_bool_indexers class MultiIndexing: def time_loc_all_bool_indexers(self, unique_levels): target = tuple([self.tgt_bool_indexer] * self.nlevels) self.df.loc[target, :]
negative_train_query0_00721
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_slice_plus_null_slice class MultiIndexing: def time_loc_slice_plus_null_slice(self, unique_levels): target = (self.tgt_slice, self.tgt_null_slice) self.df.loc[target, :]
negative_train_query0_00722
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_null_slice_plus_slice class MultiIndexing: def time_loc_null_slice_plus_slice(self, unique_levels): target = (self.tgt_null_slice, self.tgt_slice) self.df.loc[target, :]
negative_train_query0_00723
asv_bench/benchmarks/indexing.py/MultiIndexing/time_loc_multiindex class MultiIndexing: def time_loc_multiindex(self, unique_levels): target = self.df.index[::10] self.df.loc[target]
negative_train_query0_00724
asv_bench/benchmarks/indexing.py/MultiIndexing/time_xs_level_0 class MultiIndexing: def time_xs_level_0(self, unique_levels): target = self.tgt_scalar self.df.xs(target, level=0)
negative_train_query0_00725
asv_bench/benchmarks/indexing.py/MultiIndexing/time_xs_level_1 class MultiIndexing: def time_xs_level_1(self, unique_levels): target = self.tgt_scalar self.df.xs(target, level=1)
negative_train_query0_00726
asv_bench/benchmarks/indexing.py/MultiIndexing/time_xs_full_key class MultiIndexing: def time_xs_full_key(self, unique_levels): target = tuple([self.tgt_scalar] * self.nlevels) self.df.xs(target)
negative_train_query0_00727
asv_bench/benchmarks/indexing.py/IntervalIndexing/setup_cache class IntervalIndexing: def setup_cache(self): idx = IntervalIndex.from_breaks(np.arange(1000001)) monotonic = Series(np.arange(1000000), index=idx) return monotonic
negative_train_query0_00728
asv_bench/benchmarks/indexing.py/IntervalIndexing/time_getitem_scalar class IntervalIndexing: def time_getitem_scalar(self, monotonic): monotonic[80000]
negative_train_query0_00729
asv_bench/benchmarks/indexing.py/IntervalIndexing/time_loc_scalar class IntervalIndexing: def time_loc_scalar(self, monotonic): monotonic.loc[80000]
negative_train_query0_00730
asv_bench/benchmarks/indexing.py/IntervalIndexing/time_getitem_list class IntervalIndexing: def time_getitem_list(self, monotonic): monotonic[80000:]
negative_train_query0_00731
asv_bench/benchmarks/indexing.py/IntervalIndexing/time_loc_list class IntervalIndexing: def time_loc_list(self, monotonic): monotonic.loc[80000:]
negative_train_query0_00732
asv_bench/benchmarks/indexing.py/DatetimeIndexIndexing/setup class DatetimeIndexIndexing: def setup(self): dti = date_range("2016-01-01", periods=10000, tz="US/Pacific") dti2 = dti.tz_convert("UTC") self.dti = dti self.dti2 = dti2
negative_train_query0_00733
asv_bench/benchmarks/indexing.py/DatetimeIndexIndexing/time_get_indexer_mismatched_tz class DatetimeIndexIndexing: def time_get_indexer_mismatched_tz(self): # reached via e.g. # ser = Series(range(len(dti)), index=dti) # ser[dti2] self.dti.get_indexer(self.dti2)
negative_train_query0_00734
asv_bench/benchmarks/indexing.py/SortedAndUnsortedDatetimeIndexLoc/setup class SortedAndUnsortedDatetimeIndexLoc: def setup(self): dti = date_range("2016-01-01", periods=10000, tz="US/Pacific") index = np.array(dti) unsorted_index = index.copy() unsorted_index[10] = unsorted_index[20] self.df_unsorted = DataFrame(index=unsorted_index, data={"a": 1}) self.df_sort = DataFrame(index=index, data={"a": 1})
negative_train_query0_00735
asv_bench/benchmarks/indexing.py/SortedAndUnsortedDatetimeIndexLoc/time_loc_unsorted class SortedAndUnsortedDatetimeIndexLoc: def time_loc_unsorted(self): self.df_unsorted.loc["2016-6-11"]
negative_train_query0_00736
asv_bench/benchmarks/indexing.py/SortedAndUnsortedDatetimeIndexLoc/time_loc_sorted class SortedAndUnsortedDatetimeIndexLoc: def time_loc_sorted(self): self.df_sort.loc["2016-6-11"]
negative_train_query0_00737
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/setup class CategoricalIndexIndexing: def setup(self, index): N = 10**5 values = list("a" * N + "b" * N + "c" * N) indices = { "monotonic_incr": CategoricalIndex(values), "monotonic_decr": CategoricalIndex(reversed(values)), "non_monotonic": CategoricalIndex(list("abc" * N)), } self.data = indices[index] self.data_unique = CategoricalIndex([str(i) for i in range(N * 3)]) self.int_scalar = 10000 self.int_list = list(range(10000)) self.cat_scalar = "b" self.cat_list = ["1", "3"]
negative_train_query0_00738
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_getitem_scalar class CategoricalIndexIndexing: def time_getitem_scalar(self, index): self.data[self.int_scalar]
negative_train_query0_00739
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_getitem_slice class CategoricalIndexIndexing: def time_getitem_slice(self, index): self.data[: self.int_scalar]
negative_train_query0_00740
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_getitem_list_like class CategoricalIndexIndexing: def time_getitem_list_like(self, index): self.data[[self.int_scalar]]
negative_train_query0_00741
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_getitem_list class CategoricalIndexIndexing: def time_getitem_list(self, index): self.data[self.int_list]
negative_train_query0_00742
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_getitem_bool_array class CategoricalIndexIndexing: def time_getitem_bool_array(self, index): self.data[self.data == self.cat_scalar]
negative_train_query0_00743
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_get_loc_scalar class CategoricalIndexIndexing: def time_get_loc_scalar(self, index): self.data.get_loc(self.cat_scalar)
negative_train_query0_00744
asv_bench/benchmarks/indexing.py/CategoricalIndexIndexing/time_get_indexer_list class CategoricalIndexIndexing: def time_get_indexer_list(self, index): self.data_unique.get_indexer(self.cat_list)
negative_train_query0_00745
asv_bench/benchmarks/indexing.py/MethodLookup/setup_cache class MethodLookup: def setup_cache(self): s = Series() return s
negative_train_query0_00746
asv_bench/benchmarks/indexing.py/MethodLookup/time_lookup_iloc class MethodLookup: def time_lookup_iloc(self, s): s.iloc
negative_train_query0_00747
asv_bench/benchmarks/indexing.py/MethodLookup/time_lookup_loc class MethodLookup: def time_lookup_loc(self, s): s.loc
negative_train_query0_00748
asv_bench/benchmarks/indexing.py/GetItemSingleColumn/setup class GetItemSingleColumn: def setup(self): self.df_string_col = DataFrame(np.random.randn(3000, 1), columns=["A"]) self.df_int_col = DataFrame(np.random.randn(3000, 1))
negative_train_query0_00749
asv_bench/benchmarks/indexing.py/GetItemSingleColumn/time_frame_getitem_single_column_label class GetItemSingleColumn: def time_frame_getitem_single_column_label(self): self.df_string_col["A"]
negative_train_query0_00750
asv_bench/benchmarks/indexing.py/GetItemSingleColumn/time_frame_getitem_single_column_int class GetItemSingleColumn: def time_frame_getitem_single_column_int(self): self.df_int_col[0]
negative_train_query0_00751
asv_bench/benchmarks/indexing.py/IndexSingleRow/setup class IndexSingleRow: def setup(self, unique_cols): arr = np.arange(10**7).reshape(-1, 10) df = DataFrame(arr) dtypes = ["u1", "u2", "u4", "u8", "i1", "i2", "i4", "i8", "f8", "f4"] for i, d in enumerate(dtypes): df[i] = df[i].astype(d) if not unique_cols: # GH#33032 single-row lookups with non-unique columns were # 15x slower than with unique columns df.columns = ["A", "A"] + list(df.columns[2:]) self.df = df
negative_train_query0_00752
asv_bench/benchmarks/indexing.py/IndexSingleRow/time_iloc_row class IndexSingleRow: def time_iloc_row(self, unique_cols): self.df.iloc[10000]
negative_train_query0_00753
asv_bench/benchmarks/indexing.py/IndexSingleRow/time_loc_row class IndexSingleRow: def time_loc_row(self, unique_cols): self.df.loc[10000]
negative_train_query0_00754
asv_bench/benchmarks/indexing.py/AssignTimeseriesIndex/setup class AssignTimeseriesIndex: def setup(self): N = 100000 idx = date_range("1/1/2000", periods=N, freq="h") self.df = DataFrame(np.random.randn(N, 1), columns=["A"], index=idx)
negative_train_query0_00755
asv_bench/benchmarks/indexing.py/AssignTimeseriesIndex/time_frame_assign_timeseries_index class AssignTimeseriesIndex: def time_frame_assign_timeseries_index(self): self.df["date"] = self.df.index
negative_train_query0_00756
asv_bench/benchmarks/indexing.py/InsertColumns/setup class InsertColumns: def setup(self): self.N = 10**3 self.df = DataFrame(index=range(self.N)) self.df2 = DataFrame(np.random.randn(self.N, 2))
negative_train_query0_00757
asv_bench/benchmarks/indexing.py/InsertColumns/time_insert class InsertColumns: def time_insert(self): for i in range(100): self.df.insert(0, i, np.random.randn(self.N), allow_duplicates=True)
negative_train_query0_00758
asv_bench/benchmarks/indexing.py/InsertColumns/time_insert_middle class InsertColumns: def time_insert_middle(self): # same as time_insert but inserting to a middle column rather than # front or back (which have fast-paths) for i in range(100): self.df2.insert( 1, "colname", np.random.randn(self.N), allow_duplicates=True )
negative_train_query0_00759
asv_bench/benchmarks/indexing.py/InsertColumns/time_assign_with_setitem class InsertColumns: def time_assign_with_setitem(self): for i in range(100): self.df[i] = np.random.randn(self.N)
negative_train_query0_00760
asv_bench/benchmarks/indexing.py/InsertColumns/time_assign_list_like_with_setitem class InsertColumns: def time_assign_list_like_with_setitem(self): self.df[list(range(100))] = np.random.randn(self.N, 100)
negative_train_query0_00761
asv_bench/benchmarks/indexing.py/InsertColumns/time_assign_list_of_columns_concat class InsertColumns: def time_assign_list_of_columns_concat(self): df = DataFrame(np.random.randn(self.N, 100)) concat([self.df, df], axis=1)
negative_train_query0_00762
asv_bench/benchmarks/indexing.py/Setitem/setup class Setitem: def setup(self): N = 500_000 cols = 500 self.df = DataFrame(np.random.rand(N, cols))
negative_train_query0_00763
asv_bench/benchmarks/indexing.py/Setitem/time_setitem class Setitem: def time_setitem(self): self.df[100] = 100
negative_train_query0_00764
asv_bench/benchmarks/indexing.py/Setitem/time_setitem_list class Setitem: def time_setitem_list(self): self.df[[100, 200, 300]] = 100
negative_train_query0_00765
asv_bench/benchmarks/indexing.py/SetitemObjectDtype/setup class SetitemObjectDtype: def setup(self): N = 1000 cols = 500 self.df = DataFrame(index=range(N), columns=range(cols), dtype=object)
negative_train_query0_00766
asv_bench/benchmarks/indexing.py/SetitemObjectDtype/time_setitem_object_dtype class SetitemObjectDtype: def time_setitem_object_dtype(self): self.df.loc[0, 1] = 1.0
negative_train_query0_00767
asv_bench/benchmarks/indexing.py/ChainIndexing/setup class ChainIndexing: def setup(self, mode): self.N = 1000000 self.df = DataFrame({"A": np.arange(self.N), "B": "foo"})
negative_train_query0_00768
asv_bench/benchmarks/indexing.py/ChainIndexing/time_chained_indexing class ChainIndexing: def time_chained_indexing(self, mode): df = self.df N = self.N with warnings.catch_warnings(record=True): with option_context("mode.chained_assignment", mode): df2 = df[df.A > N // 2] df2["C"] = 1.0
negative_train_query0_00769
asv_bench/benchmarks/indexing.py/Block/setup class Block: def setup(self): self.df = DataFrame( False, columns=np.arange(500).astype(str), index=date_range("2010-01-01", "2011-01-01"), )
negative_train_query0_00770
asv_bench/benchmarks/indexing.py/Block/time_test class Block: def time_test(self): start = datetime(2010, 5, 1) end = datetime(2010, 9, 1) self.df.loc[start:end, :] = True
negative_train_query0_00771
asv_bench/benchmarks/sparse.py/make_array def make_array(size, dense_proportion, fill_value, dtype): dense_size = int(size * dense_proportion) arr = np.full(size, fill_value, dtype) indexer = np.random.choice(np.arange(size), dense_size, replace=False) arr[indexer] = np.random.choice(np.arange(100, dtype=dtype), dense_size) return arr
negative_train_query0_00772
asv_bench/benchmarks/sparse.py/SparseSeriesToFrame/setup class SparseSeriesToFrame: def setup(self): K = 50 N = 50001 rng = date_range("1/1/2000", periods=N, freq="min") self.series = {} for i in range(1, K): data = np.random.randn(N)[:-i] idx = rng[:-i] data[100:] = np.nan self.series[i] = Series(SparseArray(data), index=idx)
negative_train_query0_00773
asv_bench/benchmarks/sparse.py/SparseSeriesToFrame/time_series_to_frame class SparseSeriesToFrame: def time_series_to_frame(self): pd.DataFrame(self.series)
negative_train_query0_00774
asv_bench/benchmarks/sparse.py/SparseArrayConstructor/setup class SparseArrayConstructor: def setup(self, dense_proportion, fill_value, dtype): N = 10**6 self.array = make_array(N, dense_proportion, fill_value, dtype)
negative_train_query0_00775
asv_bench/benchmarks/sparse.py/SparseArrayConstructor/time_sparse_array class SparseArrayConstructor: def time_sparse_array(self, dense_proportion, fill_value, dtype): SparseArray(self.array, fill_value=fill_value, dtype=dtype)
negative_train_query0_00776
asv_bench/benchmarks/sparse.py/SparseDataFrameConstructor/setup class SparseDataFrameConstructor: def setup(self): N = 1000 self.sparse = scipy.sparse.rand(N, N, 0.005)
negative_train_query0_00777
asv_bench/benchmarks/sparse.py/SparseDataFrameConstructor/time_from_scipy class SparseDataFrameConstructor: def time_from_scipy(self): pd.DataFrame.sparse.from_spmatrix(self.sparse)
negative_train_query0_00778
asv_bench/benchmarks/sparse.py/FromCoo/setup class FromCoo: def setup(self): self.matrix = scipy.sparse.coo_matrix( ([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), shape=(100, 100) )
negative_train_query0_00779
asv_bench/benchmarks/sparse.py/FromCoo/time_sparse_series_from_coo class FromCoo: def time_sparse_series_from_coo(self): Series.sparse.from_coo(self.matrix)
negative_train_query0_00780
asv_bench/benchmarks/sparse.py/ToCoo/setup class ToCoo: def setup(self, sort_labels): s = Series([np.nan] * 10000) s[0] = 3.0 s[100] = -1.0 s[999] = 12.1 s_mult_lvl = s.set_axis(MultiIndex.from_product([range(10)] * 4)) self.ss_mult_lvl = s_mult_lvl.astype("Sparse") s_two_lvl = s.set_axis(MultiIndex.from_product([range(100)] * 2)) self.ss_two_lvl = s_two_lvl.astype("Sparse")
negative_train_query0_00781
asv_bench/benchmarks/sparse.py/ToCoo/time_sparse_series_to_coo class ToCoo: def time_sparse_series_to_coo(self, sort_labels): self.ss_mult_lvl.sparse.to_coo( row_levels=[0, 1], column_levels=[2, 3], sort_labels=sort_labels )
negative_train_query0_00782
asv_bench/benchmarks/sparse.py/ToCoo/time_sparse_series_to_coo_single_level class ToCoo: def time_sparse_series_to_coo_single_level(self, sort_labels): self.ss_two_lvl.sparse.to_coo(sort_labels=sort_labels)
negative_train_query0_00783
asv_bench/benchmarks/sparse.py/ToCooFrame/setup class ToCooFrame: def setup(self): N = 10000 k = 10 arr = np.zeros((N, k), dtype=float) arr[0, 0] = 3.0 arr[12, 7] = -1.0 arr[0, 9] = 11.2 self.df = pd.DataFrame(arr, dtype=pd.SparseDtype("float", fill_value=0.0))
negative_train_query0_00784
asv_bench/benchmarks/sparse.py/ToCooFrame/time_to_coo class ToCooFrame: def time_to_coo(self): self.df.sparse.to_coo()
negative_train_query0_00785
asv_bench/benchmarks/sparse.py/Arithmetic/setup class Arithmetic: def setup(self, dense_proportion, fill_value): N = 10**6 arr1 = make_array(N, dense_proportion, fill_value, np.int64) self.array1 = SparseArray(arr1, fill_value=fill_value) arr2 = make_array(N, dense_proportion, fill_value, np.int64) self.array2 = SparseArray(arr2, fill_value=fill_value)
negative_train_query0_00786
asv_bench/benchmarks/sparse.py/Arithmetic/time_make_union class Arithmetic: def time_make_union(self, dense_proportion, fill_value): self.array1.sp_index.make_union(self.array2.sp_index)
negative_train_query0_00787
asv_bench/benchmarks/sparse.py/Arithmetic/time_intersect class Arithmetic: def time_intersect(self, dense_proportion, fill_value): self.array1.sp_index.intersect(self.array2.sp_index)
negative_train_query0_00788
asv_bench/benchmarks/sparse.py/Arithmetic/time_add class Arithmetic: def time_add(self, dense_proportion, fill_value): self.array1 + self.array2
negative_train_query0_00789
asv_bench/benchmarks/sparse.py/Arithmetic/time_divide class Arithmetic: def time_divide(self, dense_proportion, fill_value): self.array1 / self.array2
negative_train_query0_00790
asv_bench/benchmarks/sparse.py/ArithmeticBlock/setup class ArithmeticBlock: def setup(self, fill_value): N = 10**6 self.arr1 = self.make_block_array( length=N, num_blocks=1000, block_size=10, fill_value=fill_value ) self.arr2 = self.make_block_array( length=N, num_blocks=1000, block_size=10, fill_value=fill_value )
negative_train_query0_00791
asv_bench/benchmarks/sparse.py/ArithmeticBlock/make_block_array class ArithmeticBlock: def make_block_array(self, length, num_blocks, block_size, fill_value): arr = np.full(length, fill_value) indices = np.random.choice( np.arange(0, length, block_size), num_blocks, replace=False ) for ind in indices: arr[ind : ind + block_size] = np.random.randint(0, 100, block_size) return SparseArray(arr, fill_value=fill_value)
negative_train_query0_00792
asv_bench/benchmarks/sparse.py/ArithmeticBlock/time_make_union class ArithmeticBlock: def time_make_union(self, fill_value): self.arr1.sp_index.make_union(self.arr2.sp_index)
negative_train_query0_00793
asv_bench/benchmarks/sparse.py/ArithmeticBlock/time_intersect class ArithmeticBlock: def time_intersect(self, fill_value): self.arr2.sp_index.intersect(self.arr2.sp_index)
negative_train_query0_00794
asv_bench/benchmarks/sparse.py/ArithmeticBlock/time_addition class ArithmeticBlock: def time_addition(self, fill_value): self.arr1 + self.arr2
negative_train_query0_00795
asv_bench/benchmarks/sparse.py/ArithmeticBlock/time_division class ArithmeticBlock: def time_division(self, fill_value): self.arr1 / self.arr2
negative_train_query0_00796
asv_bench/benchmarks/sparse.py/MinMax/setup class MinMax: def setup(self, func, fill_value): N = 1_000_000 arr = make_array(N, 1e-5, fill_value, np.float64) self.sp_arr = SparseArray(arr, fill_value=fill_value)
negative_train_query0_00797