diff --git a/pandas/tests/frame/methods/test_cov_corr.py b/pandas/tests/frame/methods/test_cov_corr.py index 8e73fbf152e79..4d2d83d25e8da 100644 --- a/pandas/tests/frame/methods/test_cov_corr.py +++ b/pandas/tests/frame/methods/test_cov_corr.py @@ -355,8 +355,8 @@ def test_corrwith_series(self, datetime_frame): tm.assert_series_equal(result, expected) def test_corrwith_matches_corrcoef(self): - df1 = DataFrame(np.arange(10000), columns=["a"]) - df2 = DataFrame(np.arange(10000) ** 2, columns=["a"]) + df1 = DataFrame(np.arange(100), columns=["a"]) + df2 = DataFrame(np.arange(100) ** 2, columns=["a"]) c1 = df1.corrwith(df2)["a"] c2 = np.corrcoef(df1["a"], df2["a"])[0][1] diff --git a/pandas/tests/groupby/transform/test_transform.py b/pandas/tests/groupby/transform/test_transform.py index e91ca64bb8970..46f6367fbb3ed 100644 --- a/pandas/tests/groupby/transform/test_transform.py +++ b/pandas/tests/groupby/transform/test_transform.py @@ -87,8 +87,8 @@ def demean(arr): def test_transform_fast(): df = DataFrame( { - "id": np.arange(100000) / 3, - "val": np.random.default_rng(2).standard_normal(100000), + "id": np.arange(10) / 3, + "val": np.random.default_rng(2).standard_normal(10), } ) diff --git a/pandas/tests/indexing/test_chaining_and_caching.py b/pandas/tests/indexing/test_chaining_and_caching.py index cfadf34823b0e..2a2772d1b3453 100644 --- a/pandas/tests/indexing/test_chaining_and_caching.py +++ b/pandas/tests/indexing/test_chaining_and_caching.py @@ -17,15 +17,6 @@ msg = "A value is trying to be set on a copy of a slice from a DataFrame" -def random_text(nobs=100): - # Construct a DataFrame where each row is a random slice from 'letters' - idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(nobs, 2)) - idxs.sort(axis=1) - strings = [ascii_letters[x[0] : x[1]] for x in idxs] - - return DataFrame(strings, columns=["letters"]) - - class TestCaching: def test_slice_consolidate_invalidate_item_cache(self): # this is chained assignment, but will 'work' @@ -233,7 +224,11 @@ def test_detect_chained_assignment_is_copy_pickle(self, temp_file): @pytest.mark.arm_slow def test_detect_chained_assignment_str(self): - df = random_text(100000) + idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(100, 2)) + idxs.sort(axis=1) + strings = [ascii_letters[x[0] : x[1]] for x in idxs] + + df = DataFrame(strings, columns=["letters"]) indexer = df.letters.apply(lambda x: len(x) > 10) df.loc[indexer, "letters"] = df.loc[indexer, "letters"].apply(str.lower) diff --git a/pandas/tests/io/json/test_ujson.py b/pandas/tests/io/json/test_ujson.py index ce7bb74240c53..8e05a8e6fc5d8 100644 --- a/pandas/tests/io/json/test_ujson.py +++ b/pandas/tests/io/json/test_ujson.py @@ -1036,11 +1036,7 @@ def test_decode_floating_point(self, sign, float_number): ) def test_encode_big_set(self): - s = set() - - for x in range(100000): - s.add(x) - + s = set(range(100000)) # Make sure no Exception is raised. ujson.ujson_dumps(s) diff --git a/pandas/tests/resample/test_datetime_index.py b/pandas/tests/resample/test_datetime_index.py index 0ee5ee4ec137d..fecd24c9a4b40 100644 --- a/pandas/tests/resample/test_datetime_index.py +++ b/pandas/tests/resample/test_datetime_index.py @@ -1464,12 +1464,12 @@ def test_resample_nunique_with_date_gap(func, unit): tm.assert_series_equal(result, expected) -@pytest.mark.parametrize("n", [10000, 100000]) -@pytest.mark.parametrize("k", [10, 100, 1000]) -def test_resample_group_info(n, k, unit): +def test_resample_group_info(unit): # GH10914 # use a fixed seed to always have the same uniques + n = 100 + k = 10 prng = np.random.default_rng(2) dr = date_range(start="2015-08-27", periods=n // 10, freq="min").as_unit(unit)