File size: 2,677 Bytes
7885a28 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
date_range,
)
@pytest.fixture
def series_ints():
return Series(np.random.default_rng(2).random(4), index=np.arange(0, 8, 2))
@pytest.fixture
def frame_ints():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=np.arange(0, 8, 2),
columns=np.arange(0, 12, 3),
)
@pytest.fixture
def series_uints():
return Series(
np.random.default_rng(2).random(4),
index=Index(np.arange(0, 8, 2, dtype=np.uint64)),
)
@pytest.fixture
def frame_uints():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=Index(range(0, 8, 2), dtype=np.uint64),
columns=Index(range(0, 12, 3), dtype=np.uint64),
)
@pytest.fixture
def series_labels():
return Series(np.random.default_rng(2).standard_normal(4), index=list("abcd"))
@pytest.fixture
def frame_labels():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=list("abcd"),
columns=list("ABCD"),
)
@pytest.fixture
def series_ts():
return Series(
np.random.default_rng(2).standard_normal(4),
index=date_range("20130101", periods=4),
)
@pytest.fixture
def frame_ts():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=date_range("20130101", periods=4),
)
@pytest.fixture
def series_floats():
return Series(
np.random.default_rng(2).random(4),
index=Index(range(0, 8, 2), dtype=np.float64),
)
@pytest.fixture
def frame_floats():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=Index(range(0, 8, 2), dtype=np.float64),
columns=Index(range(0, 12, 3), dtype=np.float64),
)
@pytest.fixture
def series_mixed():
return Series(np.random.default_rng(2).standard_normal(4), index=[2, 4, "null", 8])
@pytest.fixture
def frame_mixed():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)), index=[2, 4, "null", 8]
)
@pytest.fixture
def frame_empty():
return DataFrame()
@pytest.fixture
def series_empty():
return Series(dtype=object)
@pytest.fixture
def frame_multi():
return DataFrame(
np.random.default_rng(2).standard_normal((4, 4)),
index=MultiIndex.from_product([[1, 2], [3, 4]]),
columns=MultiIndex.from_product([[5, 6], [7, 8]]),
)
@pytest.fixture
def series_multi():
return Series(
np.random.default_rng(2).random(4),
index=MultiIndex.from_product([[1, 2], [3, 4]]),
)
|