Skip to content

Commit d178aec

Browse files
committed
cft
1 parent 0e162c6 commit d178aec

File tree

1 file changed

+84
-14
lines changed

1 file changed

+84
-14
lines changed

pandas/tests/frame/conftest.py

+84-14
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,67 @@
88

99

1010
@pytest.fixture
11-
def frame():
11+
def float_frame():
12+
"""
13+
Fixture for DataFrame of floats with index of unique strings
14+
15+
Columns are ['A', 'B', 'C', 'D'].
16+
"""
1217
return DataFrame(tm.getSeriesData())
1318

1419

1520
@pytest.fixture
16-
def frame2():
21+
def float_frame2():
22+
"""
23+
Fixture for DataFrame of floats with index of unique strings
24+
25+
Columns are ['D', 'C', 'B', 'A']
26+
"""
1727
return DataFrame(tm.getSeriesData(), columns=['D', 'C', 'B', 'A'])
1828

1929

2030
@pytest.fixture
21-
def intframe():
31+
def int_frame():
32+
"""
33+
Fixture for DataFrame of ints with index of unique strings
34+
35+
Columns are ['A', 'B', 'C', 'D']
36+
"""
2237
df = DataFrame({k: v.astype(int)
2338
for k, v in compat.iteritems(tm.getSeriesData())})
2439
# force these all to int64 to avoid platform testing issues
2540
return DataFrame({c: s for c, s in compat.iteritems(df)}, dtype=np.int64)
2641

2742

2843
@pytest.fixture
29-
def tsframe():
44+
def datetime_frame():
45+
"""
46+
Fixture for DataFrame of floats with DatetimeIndex
47+
48+
Columns are ['A', 'B', 'C', 'D']
49+
"""
3050
return DataFrame(tm.getTimeSeriesData())
3151

3252

3353
@pytest.fixture
34-
def mixed_frame():
54+
def float_string_frame():
55+
"""
56+
Fixture for DataFrame of floats and strings with index of unique strings
57+
58+
Columns are ['A', 'B', 'C', 'D', 'foo'].
59+
"""
3560
df = DataFrame(tm.getSeriesData())
3661
df['foo'] = 'bar'
3762
return df
3863

3964

4065
@pytest.fixture
41-
def mixed_float():
66+
def mixed_float_frame():
67+
"""
68+
Fixture for DataFrame of different float types with index of unique strings
69+
70+
Columns are ['A', 'B', 'C', 'D'].
71+
"""
4272
df = DataFrame(tm.getSeriesData())
4373
df.A = df.A.astype('float16')
4474
df.B = df.B.astype('float32')
@@ -47,7 +77,12 @@ def mixed_float():
4777

4878

4979
@pytest.fixture
50-
def mixed_float2():
80+
def mixed_float_frame2():
81+
"""
82+
Fixture for DataFrame of different float types with index of unique strings
83+
84+
Columns are ['A', 'B', 'C', 'D'].
85+
"""
5186
df = DataFrame(tm.getSeriesData())
5287
df.D = df.D.astype('float16')
5388
df.C = df.C.astype('float32')
@@ -56,7 +91,12 @@ def mixed_float2():
5691

5792

5893
@pytest.fixture
59-
def mixed_int():
94+
def mixed_int_frame():
95+
"""
96+
Fixture for DataFrame of different int types with index of unique strings
97+
98+
Columns are ['A', 'B', 'C', 'D'].
99+
"""
60100
df = DataFrame({k: v.astype(int)
61101
for k, v in compat.iteritems(tm.getSeriesData())})
62102
df.A = df.A.astype('uint8')
@@ -67,15 +107,25 @@ def mixed_int():
67107

68108

69109
@pytest.fixture
70-
def all_mixed():
110+
def mixed_type_frame():
111+
"""
112+
Fixture for DataFrame of float/int/string columns with RangeIndex
113+
114+
Columns are ['a', 'b', 'c', 'float32', 'int32'].
115+
"""
71116
return DataFrame({'a': 1., 'b': 2, 'c': 'foo',
72117
'float32': np.array([1.] * 10, dtype='float32'),
73118
'int32': np.array([1] * 10, dtype='int32')},
74119
index=np.arange(10))
75120

76121

77122
@pytest.fixture
78-
def tzframe():
123+
def timezone_frame():
124+
"""
125+
Fixture for DataFrame of date_range Series with different time zones
126+
127+
Columns are ['A', 'B', 'C']; some entries are missing
128+
"""
79129
df = DataFrame({'A': date_range('20130101', periods=3),
80130
'B': date_range('20130101', periods=3,
81131
tz='US/Eastern'),
@@ -87,22 +137,36 @@ def tzframe():
87137

88138

89139
@pytest.fixture
90-
def empty():
140+
def empty_frame():
141+
"""
142+
Fixture for empty DataFrame
143+
"""
91144
return DataFrame({})
92145

93146

94147
@pytest.fixture
95-
def ts1():
148+
def datetime_series():
149+
"""
150+
Fixture for Series of floats with DatetimeIndex
151+
"""
96152
return tm.makeTimeSeries(nper=30)
97153

98154

99155
@pytest.fixture
100-
def ts2():
156+
def datetime_series_short():
157+
"""
158+
Fixture for Series of floats with DatetimeIndex
159+
"""
101160
return tm.makeTimeSeries(nper=30)[5:]
102161

103162

104163
@pytest.fixture
105-
def simple():
164+
def simple_frame():
165+
"""
166+
Fixture for simple 3x3 DataFrame
167+
168+
Columns are ['one', 'two', 'three'], index is ['a', 'b', 'c'].
169+
"""
106170
arr = np.array([[1., 2., 3.],
107171
[4., 5., 6.],
108172
[7., 8., 9.]])
@@ -113,6 +177,12 @@ def simple():
113177

114178
@pytest.fixture
115179
def frame_of_index_cols():
180+
"""
181+
Fixture for DataFrame of columns that can be used for indexing
182+
183+
Columns are ['A', 'B', 'C', 'D', 'E']; 'A' & 'B' contain duplicates (but
184+
are jointly unique), the rest are unique.
185+
"""
116186
df = DataFrame({'A': ['foo', 'foo', 'foo', 'bar', 'bar'],
117187
'B': ['one', 'two', 'three', 'one', 'two'],
118188
'C': ['a', 'b', 'c', 'd', 'e'],

0 commit comments

Comments
 (0)