title stringclasses 1 value | text stringlengths 30 426k | id stringlengths 27 30 |
|---|---|---|
asv_bench/benchmarks/sparse.py/MinMax/time_min_max
class MinMax:
def time_min_max(self, func, fill_value):
getattr(self.sp_arr, func)() | negative_train_query0_00798 | |
asv_bench/benchmarks/sparse.py/Take/setup
class Take:
def setup(self, indices, allow_fill):
N = 1_000_000
fill_value = 0.0
arr = make_array(N, 1e-5, fill_value, np.float64)
self.sp_arr = SparseArray(arr, fill_value=fill_value) | negative_train_query0_00799 | |
asv_bench/benchmarks/sparse.py/Take/time_take
class Take:
def time_take(self, indices, allow_fill):
self.sp_arr.take(indices, allow_fill=allow_fill) | negative_train_query0_00800 | |
asv_bench/benchmarks/sparse.py/GetItem/setup
class GetItem:
def setup(self):
N = 1_000_000
d = 1e-5
arr = make_array(N, d, np.nan, np.float64)
self.sp_arr = SparseArray(arr) | negative_train_query0_00801 | |
asv_bench/benchmarks/sparse.py/GetItem/time_integer_indexing
class GetItem:
def time_integer_indexing(self):
self.sp_arr[78] | negative_train_query0_00802 | |
asv_bench/benchmarks/sparse.py/GetItem/time_slice
class GetItem:
def time_slice(self):
self.sp_arr[1:] | negative_train_query0_00803 | |
asv_bench/benchmarks/sparse.py/GetItemMask/setup
class GetItemMask:
def setup(self, fill_value):
N = 1_000_000
d = 1e-5
arr = make_array(N, d, np.nan, np.float64)
self.sp_arr = SparseArray(arr)
b_arr = np.full(shape=N, fill_value=fill_value, dtype=np.bool_)
fv_inds = np.unique(
np.random.randint(low=0, high=N - 1, size=int(N * d), dtype=np.int32)
)
b_arr[fv_inds] = True if pd.isna(fill_value) else not fill_value
self.sp_b_arr = SparseArray(b_arr, dtype=np.bool_, fill_value=fill_value) | negative_train_query0_00804 | |
asv_bench/benchmarks/sparse.py/GetItemMask/time_mask
class GetItemMask:
def time_mask(self, fill_value):
self.sp_arr[self.sp_b_arr] | negative_train_query0_00805 | |
asv_bench/benchmarks/categoricals.py/Constructor/setup
class Constructor:
def setup(self):
N = 10**5
self.categories = list("abcde")
self.cat_idx = pd.Index(self.categories)
self.values = np.tile(self.categories, N)
self.codes = np.tile(range(len(self.categories)), N)
self.datetimes = pd.Series(
pd.date_range("1995-01-01 00:00:00", periods=N // 10, freq="s")
)
self.datetimes_with_nat = self.datetimes.copy()
self.datetimes_with_nat.iloc[-1] = pd.NaT
self.values_some_nan = list(np.tile(self.categories + [np.nan], N))
self.values_all_nan = [np.nan] * len(self.values)
self.values_all_int8 = np.ones(N, "int8")
self.categorical = pd.Categorical(self.values, self.categories)
self.series = pd.Series(self.categorical)
self.intervals = pd.interval_range(0, 1, periods=N // 10) | negative_train_query0_00806 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_regular
class Constructor:
def time_regular(self):
pd.Categorical(self.values, self.categories) | negative_train_query0_00807 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_fastpath
class Constructor:
def time_fastpath(self):
dtype = pd.CategoricalDtype(categories=self.cat_idx)
pd.Categorical._simple_new(self.codes, dtype) | negative_train_query0_00808 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_datetimes
class Constructor:
def time_datetimes(self):
pd.Categorical(self.datetimes) | negative_train_query0_00809 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_interval
class Constructor:
def time_interval(self):
pd.Categorical(self.datetimes, categories=self.datetimes) | negative_train_query0_00810 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_datetimes_with_nat
class Constructor:
def time_datetimes_with_nat(self):
pd.Categorical(self.datetimes_with_nat) | negative_train_query0_00811 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_with_nan
class Constructor:
def time_with_nan(self):
pd.Categorical(self.values_some_nan) | negative_train_query0_00812 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_all_nan
class Constructor:
def time_all_nan(self):
pd.Categorical(self.values_all_nan) | negative_train_query0_00813 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_from_codes_all_int8
class Constructor:
def time_from_codes_all_int8(self):
pd.Categorical.from_codes(self.values_all_int8, self.categories) | negative_train_query0_00814 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_existing_categorical
class Constructor:
def time_existing_categorical(self):
pd.Categorical(self.categorical) | negative_train_query0_00815 | |
asv_bench/benchmarks/categoricals.py/Constructor/time_existing_series
class Constructor:
def time_existing_series(self):
pd.Categorical(self.series) | negative_train_query0_00816 | |
asv_bench/benchmarks/categoricals.py/AsType/setup
class AsType:
def setup(self):
N = 10**5
random_pick = np.random.default_rng().choice
categories = {
"str": list(string.ascii_letters),
"int": np.random.randint(2**16, size=154),
"float": sys.maxsize * np.random.random((38,)),
"timestamp": [
pd.Timestamp(x, unit="s") for x in np.random.randint(2**18, size=578)
],
}
self.df = pd.DataFrame(
{col: random_pick(cats, N) for col, cats in categories.items()}
)
for col in ("int", "float", "timestamp"):
self.df[f"{col}_as_str"] = self.df[col].astype(str)
for col in self.df.columns:
self.df[col] = self.df[col].astype("category") | negative_train_query0_00817 | |
asv_bench/benchmarks/categoricals.py/AsType/astype_str
class AsType:
def astype_str(self):
[self.df[col].astype("str") for col in "int float timestamp".split()] | negative_train_query0_00818 | |
asv_bench/benchmarks/categoricals.py/AsType/astype_int
class AsType:
def astype_int(self):
[self.df[col].astype("int") for col in "int_as_str timestamp".split()] | negative_train_query0_00819 | |
asv_bench/benchmarks/categoricals.py/AsType/astype_float
class AsType:
def astype_float(self):
[
self.df[col].astype("float")
for col in "float_as_str int int_as_str timestamp".split()
] | negative_train_query0_00820 | |
asv_bench/benchmarks/categoricals.py/AsType/astype_datetime
class AsType:
def astype_datetime(self):
self.df["float"].astype(pd.DatetimeTZDtype(tz="US/Pacific")) | negative_train_query0_00821 | |
asv_bench/benchmarks/categoricals.py/Concat/setup
class Concat:
def setup(self):
N = 10**5
self.s = pd.Series(list("aabbcd") * N).astype("category")
self.a = pd.Categorical(list("aabbcd") * N)
self.b = pd.Categorical(list("bbcdjk") * N)
self.idx_a = pd.CategoricalIndex(range(N), range(N))
self.idx_b = pd.CategoricalIndex(range(N + 1), range(N + 1))
self.df_a = pd.DataFrame(range(N), columns=["a"], index=self.idx_a)
self.df_b = pd.DataFrame(range(N + 1), columns=["a"], index=self.idx_b) | negative_train_query0_00822 | |
asv_bench/benchmarks/categoricals.py/Concat/time_concat
class Concat:
def time_concat(self):
pd.concat([self.s, self.s]) | negative_train_query0_00823 | |
asv_bench/benchmarks/categoricals.py/Concat/time_union
class Concat:
def time_union(self):
union_categoricals([self.a, self.b]) | negative_train_query0_00824 | |
asv_bench/benchmarks/categoricals.py/Concat/time_append_overlapping_index
class Concat:
def time_append_overlapping_index(self):
self.idx_a.append(self.idx_a) | negative_train_query0_00825 | |
asv_bench/benchmarks/categoricals.py/Concat/time_append_non_overlapping_index
class Concat:
def time_append_non_overlapping_index(self):
self.idx_a.append(self.idx_b) | negative_train_query0_00826 | |
asv_bench/benchmarks/categoricals.py/Concat/time_concat_overlapping_index
class Concat:
def time_concat_overlapping_index(self):
pd.concat([self.df_a, self.df_a]) | negative_train_query0_00827 | |
asv_bench/benchmarks/categoricals.py/Concat/time_concat_non_overlapping_index
class Concat:
def time_concat_non_overlapping_index(self):
pd.concat([self.df_a, self.df_b]) | negative_train_query0_00828 | |
asv_bench/benchmarks/categoricals.py/ValueCounts/setup
class ValueCounts:
def setup(self, dropna):
n = 5 * 10**5
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
self.ts = pd.Series(arr).astype("category") | negative_train_query0_00829 | |
asv_bench/benchmarks/categoricals.py/ValueCounts/time_value_counts
class ValueCounts:
def time_value_counts(self, dropna):
self.ts.value_counts(dropna=dropna) | negative_train_query0_00830 | |
asv_bench/benchmarks/categoricals.py/Repr/setup
class Repr:
def setup(self):
self.sel = pd.Series(["s1234"]).astype("category") | negative_train_query0_00831 | |
asv_bench/benchmarks/categoricals.py/Repr/time_rendering
class Repr:
def time_rendering(self):
str(self.sel) | negative_train_query0_00832 | |
asv_bench/benchmarks/categoricals.py/SetCategories/setup
class SetCategories:
def setup(self):
n = 5 * 10**5
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
self.ts = pd.Series(arr).astype("category") | negative_train_query0_00833 | |
asv_bench/benchmarks/categoricals.py/SetCategories/time_set_categories
class SetCategories:
def time_set_categories(self):
self.ts.cat.set_categories(self.ts.cat.categories[::2]) | negative_train_query0_00834 | |
asv_bench/benchmarks/categoricals.py/RemoveCategories/setup
class RemoveCategories:
def setup(self):
n = 5 * 10**5
arr = [f"s{i:04d}" for i in np.random.randint(0, n // 10, size=n)]
self.ts = pd.Series(arr).astype("category") | negative_train_query0_00835 | |
asv_bench/benchmarks/categoricals.py/RemoveCategories/time_remove_categories
class RemoveCategories:
def time_remove_categories(self):
self.ts.cat.remove_categories(self.ts.cat.categories[::2]) | negative_train_query0_00836 | |
asv_bench/benchmarks/categoricals.py/Rank/setup
class Rank:
def setup(self):
N = 10**5
ncats = 15
self.s_str = pd.Series(np.random.randint(0, ncats, size=N).astype(str))
self.s_str_cat = pd.Series(self.s_str, dtype="category")
with warnings.catch_warnings(record=True):
str_cat_type = pd.CategoricalDtype(set(self.s_str), ordered=True)
self.s_str_cat_ordered = self.s_str.astype(str_cat_type)
self.s_int = pd.Series(np.random.randint(0, ncats, size=N))
self.s_int_cat = pd.Series(self.s_int, dtype="category")
with warnings.catch_warnings(record=True):
int_cat_type = pd.CategoricalDtype(set(self.s_int), ordered=True)
self.s_int_cat_ordered = self.s_int.astype(int_cat_type) | negative_train_query0_00837 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_string
class Rank:
def time_rank_string(self):
self.s_str.rank() | negative_train_query0_00838 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_string_cat
class Rank:
def time_rank_string_cat(self):
self.s_str_cat.rank() | negative_train_query0_00839 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_string_cat_ordered
class Rank:
def time_rank_string_cat_ordered(self):
self.s_str_cat_ordered.rank() | negative_train_query0_00840 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_int
class Rank:
def time_rank_int(self):
self.s_int.rank() | negative_train_query0_00841 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_int_cat
class Rank:
def time_rank_int_cat(self):
self.s_int_cat.rank() | negative_train_query0_00842 | |
asv_bench/benchmarks/categoricals.py/Rank/time_rank_int_cat_ordered
class Rank:
def time_rank_int_cat_ordered(self):
self.s_int_cat_ordered.rank() | negative_train_query0_00843 | |
asv_bench/benchmarks/categoricals.py/IsMonotonic/setup
class IsMonotonic:
def setup(self):
N = 1000
self.c = pd.CategoricalIndex(list("a" * N + "b" * N + "c" * N))
self.s = pd.Series(self.c) | negative_train_query0_00844 | |
asv_bench/benchmarks/categoricals.py/IsMonotonic/time_categorical_index_is_monotonic_increasing
class IsMonotonic:
def time_categorical_index_is_monotonic_increasing(self):
self.c.is_monotonic_increasing | negative_train_query0_00845 | |
asv_bench/benchmarks/categoricals.py/IsMonotonic/time_categorical_index_is_monotonic_decreasing
class IsMonotonic:
def time_categorical_index_is_monotonic_decreasing(self):
self.c.is_monotonic_decreasing | negative_train_query0_00846 | |
asv_bench/benchmarks/categoricals.py/IsMonotonic/time_categorical_series_is_monotonic_increasing
class IsMonotonic:
def time_categorical_series_is_monotonic_increasing(self):
self.s.is_monotonic_increasing | negative_train_query0_00847 | |
asv_bench/benchmarks/categoricals.py/IsMonotonic/time_categorical_series_is_monotonic_decreasing
class IsMonotonic:
def time_categorical_series_is_monotonic_decreasing(self):
self.s.is_monotonic_decreasing | negative_train_query0_00848 | |
asv_bench/benchmarks/categoricals.py/Contains/setup
class Contains:
def setup(self):
N = 10**5
self.ci = pd.CategoricalIndex(np.arange(N))
self.c = self.ci.values
self.key = self.ci.categories[0] | negative_train_query0_00849 | |
asv_bench/benchmarks/categoricals.py/Contains/time_categorical_index_contains
class Contains:
def time_categorical_index_contains(self):
self.key in self.ci | negative_train_query0_00850 | |
asv_bench/benchmarks/categoricals.py/Contains/time_categorical_contains
class Contains:
def time_categorical_contains(self):
self.key in self.c | negative_train_query0_00851 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/setup
class CategoricalSlicing:
def setup(self, index):
N = 10**6
categories = ["a", "b", "c"]
if index == "monotonic_incr":
codes = np.repeat([0, 1, 2], N)
elif index == "monotonic_decr":
codes = np.repeat([2, 1, 0], N)
elif index == "non_monotonic":
codes = np.tile([0, 1, 2], N)
else:
raise ValueError(f"Invalid index param: {index}")
self.data = pd.Categorical.from_codes(codes, categories=categories)
self.scalar = 10000
self.list = list(range(10000))
self.cat_scalar = "b" | negative_train_query0_00852 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/time_getitem_scalar
class CategoricalSlicing:
def time_getitem_scalar(self, index):
self.data[self.scalar] | negative_train_query0_00853 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/time_getitem_slice
class CategoricalSlicing:
def time_getitem_slice(self, index):
self.data[: self.scalar] | negative_train_query0_00854 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/time_getitem_list_like
class CategoricalSlicing:
def time_getitem_list_like(self, index):
self.data[[self.scalar]] | negative_train_query0_00855 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/time_getitem_list
class CategoricalSlicing:
def time_getitem_list(self, index):
self.data[self.list] | negative_train_query0_00856 | |
asv_bench/benchmarks/categoricals.py/CategoricalSlicing/time_getitem_bool_array
class CategoricalSlicing:
def time_getitem_bool_array(self, index):
self.data[self.data == self.cat_scalar] | negative_train_query0_00857 | |
asv_bench/benchmarks/categoricals.py/Indexing/setup
class Indexing:
def setup(self):
N = 10**5
self.index = pd.CategoricalIndex(range(N), range(N))
self.series = pd.Series(range(N), index=self.index).sort_index()
self.category = self.index[500] | negative_train_query0_00858 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_get_loc
class Indexing:
def time_get_loc(self):
self.index.get_loc(self.category) | negative_train_query0_00859 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_shallow_copy
class Indexing:
def time_shallow_copy(self):
self.index._view() | negative_train_query0_00860 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_align
class Indexing:
def time_align(self):
pd.DataFrame({"a": self.series, "b": self.series[:500]}) | negative_train_query0_00861 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_intersection
class Indexing:
def time_intersection(self):
self.index[:750].intersection(self.index[250:]) | negative_train_query0_00862 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_unique
class Indexing:
def time_unique(self):
self.index.unique() | negative_train_query0_00863 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_reindex
class Indexing:
def time_reindex(self):
self.index.reindex(self.index[:500]) | negative_train_query0_00864 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_reindex_missing
class Indexing:
def time_reindex_missing(self):
self.index.reindex(["a", "b", "c", "d"]) | negative_train_query0_00865 | |
asv_bench/benchmarks/categoricals.py/Indexing/time_sort_values
class Indexing:
def time_sort_values(self):
self.index.sort_values(ascending=False) | negative_train_query0_00866 | |
asv_bench/benchmarks/categoricals.py/SearchSorted/setup
class SearchSorted:
def setup(self):
N = 10**5
self.ci = pd.CategoricalIndex(np.arange(N)).sort_values()
self.c = self.ci.values
self.key = self.ci.categories[1] | negative_train_query0_00867 | |
asv_bench/benchmarks/categoricals.py/SearchSorted/time_categorical_index_contains
class SearchSorted:
def time_categorical_index_contains(self):
self.ci.searchsorted(self.key) | negative_train_query0_00868 | |
asv_bench/benchmarks/categoricals.py/SearchSorted/time_categorical_contains
class SearchSorted:
def time_categorical_contains(self):
self.c.searchsorted(self.key) | negative_train_query0_00869 | |
asv_bench/benchmarks/plotting.py/SeriesPlotting/setup
class SeriesPlotting:
def setup(self, kind):
if kind in ["bar", "barh", "pie"]:
n = 100
elif kind in ["kde"]:
n = 10000
else:
n = 1000000
self.s = Series(np.random.randn(n))
if kind in ["area", "pie"]:
self.s = self.s.abs() | negative_train_query0_00870 | |
asv_bench/benchmarks/plotting.py/SeriesPlotting/time_series_plot
class SeriesPlotting:
def time_series_plot(self, kind):
self.s.plot(kind=kind) | negative_train_query0_00871 | |
asv_bench/benchmarks/plotting.py/FramePlotting/setup
class FramePlotting:
def setup(self, kind):
if kind in ["bar", "barh", "pie"]:
n = 100
elif kind in ["kde", "scatter", "hexbin"]:
n = 10000
else:
n = 1000000
self.x = Series(np.random.randn(n))
self.y = Series(np.random.randn(n))
if kind in ["area", "pie"]:
self.x = self.x.abs()
self.y = self.y.abs()
self.df = DataFrame({"x": self.x, "y": self.y}) | negative_train_query0_00872 | |
asv_bench/benchmarks/plotting.py/FramePlotting/time_frame_plot
class FramePlotting:
def time_frame_plot(self, kind):
self.df.plot(x="x", y="y", kind=kind) | negative_train_query0_00873 | |
asv_bench/benchmarks/plotting.py/TimeseriesPlotting/setup
class TimeseriesPlotting:
def setup(self):
N = 2000
M = 5
idx = date_range("1/1/1975", periods=N)
self.df = DataFrame(np.random.randn(N, M), index=idx)
idx_irregular = DatetimeIndex(
np.concatenate((idx.values[0:10], idx.values[12:]))
)
self.df2 = DataFrame(
np.random.randn(len(idx_irregular), M), index=idx_irregular
) | negative_train_query0_00874 | |
asv_bench/benchmarks/plotting.py/TimeseriesPlotting/time_plot_regular
class TimeseriesPlotting:
def time_plot_regular(self):
self.df.plot() | negative_train_query0_00875 | |
asv_bench/benchmarks/plotting.py/TimeseriesPlotting/time_plot_regular_compat
class TimeseriesPlotting:
def time_plot_regular_compat(self):
self.df.plot(x_compat=True) | negative_train_query0_00876 | |
asv_bench/benchmarks/plotting.py/TimeseriesPlotting/time_plot_irregular
class TimeseriesPlotting:
def time_plot_irregular(self):
self.df2.plot() | negative_train_query0_00877 | |
asv_bench/benchmarks/plotting.py/TimeseriesPlotting/time_plot_table
class TimeseriesPlotting:
def time_plot_table(self):
self.df.plot(table=True) | negative_train_query0_00878 | |
asv_bench/benchmarks/plotting.py/Misc/setup
class Misc:
def setup(self):
N = 500
M = 10
self.df = DataFrame(np.random.randn(N, M))
self.df["Name"] = ["A"] * N | negative_train_query0_00879 | |
asv_bench/benchmarks/plotting.py/Misc/time_plot_andrews_curves
class Misc:
def time_plot_andrews_curves(self):
andrews_curves(self.df, "Name") | negative_train_query0_00880 | |
asv_bench/benchmarks/plotting.py/BackendLoading/setup
class BackendLoading:
def setup(self):
mod = importlib.util.module_from_spec(
importlib.machinery.ModuleSpec("pandas_dummy_backend", None)
)
mod.plot = lambda *args, **kwargs: 1
with contextlib.ExitStack() as stack:
stack.enter_context(
mock.patch.dict(sys.modules, {"pandas_dummy_backend": mod})
)
tmp_path = pathlib.Path(stack.enter_context(tempfile.TemporaryDirectory()))
sys.path.insert(0, os.fsdecode(tmp_path))
stack.callback(sys.path.remove, os.fsdecode(tmp_path))
dist_info = tmp_path / "my_backend-0.0.0.dist-info"
dist_info.mkdir()
(dist_info / "entry_points.txt").write_bytes(
b"[pandas_plotting_backends]\n"
b"my_ep_backend = pandas_dummy_backend\n"
b"my_ep_backend0 = pandas_dummy_backend\n"
b"my_ep_backend1 = pandas_dummy_backend\n"
b"my_ep_backend2 = pandas_dummy_backend\n"
b"my_ep_backend3 = pandas_dummy_backend\n"
b"my_ep_backend4 = pandas_dummy_backend\n"
b"my_ep_backend5 = pandas_dummy_backend\n"
b"my_ep_backend6 = pandas_dummy_backend\n"
b"my_ep_backend7 = pandas_dummy_backend\n"
b"my_ep_backend8 = pandas_dummy_backend\n"
b"my_ep_backend9 = pandas_dummy_backend\n"
)
self.stack = stack.pop_all() | negative_train_query0_00881 | |
asv_bench/benchmarks/plotting.py/BackendLoading/teardown
class BackendLoading:
def teardown(self):
self.stack.close() | negative_train_query0_00882 | |
asv_bench/benchmarks/plotting.py/BackendLoading/time_get_plot_backend
class BackendLoading:
def time_get_plot_backend(self):
# finds the first my_ep_backend
_get_plot_backend("my_ep_backend") | negative_train_query0_00883 | |
asv_bench/benchmarks/plotting.py/BackendLoading/time_get_plot_backend_fallback
class BackendLoading:
def time_get_plot_backend_fallback(self):
# iterates through all the my_ep_backend[0-9] before falling back
# to importlib.import_module
_get_plot_backend("pandas_dummy_backend") | negative_train_query0_00884 | |
asv_bench/benchmarks/period.py/PeriodIndexConstructor/setup
class PeriodIndexConstructor:
def setup(self, freq, is_offset):
self.rng = date_range("1985", periods=1000)
self.rng2 = date_range("1985", periods=1000).to_pydatetime()
self.ints = list(range(2000, 3000))
self.daily_ints = (
date_range("1/1/2000", periods=1000, freq=freq).strftime("%Y%m%d").map(int)
)
if is_offset:
self.freq = to_offset(freq)
else:
self.freq = freq | negative_train_query0_00885 | |
asv_bench/benchmarks/period.py/PeriodIndexConstructor/time_from_date_range
class PeriodIndexConstructor:
def time_from_date_range(self, freq, is_offset):
PeriodIndex(self.rng, freq=freq) | negative_train_query0_00886 | |
asv_bench/benchmarks/period.py/PeriodIndexConstructor/time_from_pydatetime
class PeriodIndexConstructor:
def time_from_pydatetime(self, freq, is_offset):
PeriodIndex(self.rng2, freq=freq) | negative_train_query0_00887 | |
asv_bench/benchmarks/period.py/PeriodIndexConstructor/time_from_ints
class PeriodIndexConstructor:
def time_from_ints(self, freq, is_offset):
PeriodIndex(self.ints, freq=freq) | negative_train_query0_00888 | |
asv_bench/benchmarks/period.py/PeriodIndexConstructor/time_from_ints_daily
class PeriodIndexConstructor:
def time_from_ints_daily(self, freq, is_offset):
PeriodIndex(self.daily_ints, freq=freq) | negative_train_query0_00889 | |
asv_bench/benchmarks/period.py/DataFramePeriodColumn/setup
class DataFramePeriodColumn:
def setup(self):
self.rng = period_range(start="1/1/1990", freq="s", periods=20000)
self.df = DataFrame(index=range(len(self.rng))) | negative_train_query0_00890 | |
asv_bench/benchmarks/period.py/DataFramePeriodColumn/time_setitem_period_column
class DataFramePeriodColumn:
def time_setitem_period_column(self):
self.df["col"] = self.rng | negative_train_query0_00891 | |
asv_bench/benchmarks/period.py/DataFramePeriodColumn/time_set_index
class DataFramePeriodColumn:
def time_set_index(self):
# GH#21582 limited by comparisons of Period objects
self.df["col2"] = self.rng
self.df.set_index("col2", append=True) | negative_train_query0_00892 | |
asv_bench/benchmarks/period.py/Algorithms/setup
class Algorithms:
def setup(self, typ):
data = [
Period("2011-01", freq="M"),
Period("2011-02", freq="M"),
Period("2011-03", freq="M"),
Period("2011-04", freq="M"),
]
if typ == "index":
self.vector = PeriodIndex(data * 1000, freq="M")
elif typ == "series":
self.vector = Series(data * 1000) | negative_train_query0_00893 | |
asv_bench/benchmarks/period.py/Algorithms/time_drop_duplicates
class Algorithms:
def time_drop_duplicates(self, typ):
self.vector.drop_duplicates() | negative_train_query0_00894 | |
asv_bench/benchmarks/period.py/Algorithms/time_value_counts
class Algorithms:
def time_value_counts(self, typ):
self.vector.value_counts() | negative_train_query0_00895 | |
asv_bench/benchmarks/period.py/Indexing/setup
class Indexing:
def setup(self):
self.index = period_range(start="1985", periods=1000, freq="D")
self.series = Series(range(1000), index=self.index)
self.period = self.index[500] | negative_train_query0_00896 | |
asv_bench/benchmarks/period.py/Indexing/time_get_loc
class Indexing:
def time_get_loc(self):
self.index.get_loc(self.period) | negative_train_query0_00897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.