forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconftest.py
48 lines (40 loc) · 1.1 KB
/
conftest.py
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
import numpy as np
import pytest
from pandas import (
DataFrame,
to_datetime,
)
@pytest.fixture(autouse=True)
def reset_rcParams():
mpl = pytest.importorskip("matplotlib")
with mpl.rc_context():
yield
@pytest.fixture(autouse=True)
def close_all_figures():
yield
plt = pytest.importorskip("matplotlib.pyplot")
plt.close("all")
@pytest.fixture
def hist_df():
n = 100
np_random = np.random.RandomState(42)
gender = np_random.choice(["Male", "Female"], size=n)
classroom = np_random.choice(["A", "B", "C"], size=n)
hist_df = DataFrame(
{
"gender": gender,
"classroom": classroom,
"height": np.random.normal(66, 4, size=n),
"weight": np.random.normal(161, 32, size=n),
"category": np.random.randint(4, size=n),
"datetime": to_datetime(
np.random.randint(
812419200000000000,
819331200000000000,
size=n,
dtype=np.int64,
)
),
}
)
return hist_df