7
7
from pandas import DataFrame , date_range , NaT
8
8
9
9
10
- # This module is the start of transitioning from attributes of
11
- # pandas/tests/frame/common.TestData towards fixtures (GH22471).
12
- # Until all modules have been transitioned, it is advised not to change
13
- # the (admittedly suboptimal) names of these fixtures.
14
-
15
10
@pytest .fixture
16
- def frame ():
11
+ def float_frame ():
17
12
"""
18
13
Fixture for DataFrame of floats with index of unique strings
19
14
20
- After completing the fixturization of the frame tests (GH 22471), this
21
- fixture will be renamed to: float_frame_string_index
22
-
23
- Columns are ['A', 'B', 'C', 'D'], see pandas.util.testing.getSeriesData
15
+ Columns are ['A', 'B', 'C', 'D'].
24
16
"""
25
17
return DataFrame (tm .getSeriesData ())
26
18
27
19
28
20
@pytest .fixture
29
- def frame2 ():
21
+ def float_frame2 ():
30
22
"""
31
23
Fixture for DataFrame of floats with index of unique strings
32
24
33
- After completing the fixturization of the frame tests (GH 22471), this
34
- fixture will be renamed to: float_frame_string_index2
35
-
36
- Columns are ['D', 'C', 'B', 'A']. See pandas.util.testing.getSeriesData
25
+ Columns are ['D', 'C', 'B', 'A']
37
26
"""
38
27
return DataFrame (tm .getSeriesData (), columns = ['D' , 'C' , 'B' , 'A' ])
39
28
40
29
41
30
@pytest .fixture
42
- def intframe ():
31
+ def int_frame ():
43
32
"""
44
33
Fixture for DataFrame of ints with index of unique strings
45
34
46
- After completing the fixturization of the frame tests (GH 22471), this
47
- fixture will be renamed to: int_frame
48
-
49
- Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
35
+ Columns are ['A', 'B', 'C', 'D']
50
36
"""
51
37
df = DataFrame ({k : v .astype (int )
52
38
for k , v in compat .iteritems (tm .getSeriesData ())})
@@ -55,43 +41,33 @@ def intframe():
55
41
56
42
57
43
@pytest .fixture
58
- def tsframe ():
44
+ def datetime_frame ():
59
45
"""
60
46
Fixture for DataFrame of floats with DatetimeIndex
61
47
62
- After completing the fixturization of the frame tests (GH 22471), this
63
- fixture will be renamed to: float_frame_datetime_index
64
-
65
- Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getTimeSeriesData
48
+ Columns are ['A', 'B', 'C', 'D']
66
49
"""
67
50
return DataFrame (tm .getTimeSeriesData ())
68
51
69
52
70
53
@pytest .fixture
71
- def mixed_frame ():
54
+ def float_string_frame ():
72
55
"""
73
- Fixture for DataFrame of floats and strings with string index
74
-
75
- After completing the fixturization of the frame tests (GH 22471), this
76
- fixture will be renamed to: float_string_frame
56
+ Fixture for DataFrame of floats and strings with index of unique strings
77
57
78
58
Columns are ['A', 'B', 'C', 'D', 'foo'].
79
- See pandas.util.testing.getSeriesData
80
59
"""
81
60
df = DataFrame (tm .getSeriesData ())
82
61
df ['foo' ] = 'bar'
83
62
return df
84
63
85
64
86
65
@pytest .fixture
87
- def mixed_float ():
66
+ def mixed_float_frame ():
88
67
"""
89
- Fixture for DataFrame of different float types with string index
90
-
91
- After completing the fixturization of the frame tests (GH 22471), this
92
- fixture will be renamed to: mixed_float_frame
68
+ Fixture for DataFrame of different float types with index of unique strings
93
69
94
- Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
70
+ Columns are ['A', 'B', 'C', 'D'].
95
71
"""
96
72
df = DataFrame (tm .getSeriesData ())
97
73
df .A = df .A .astype ('float16' )
@@ -101,14 +77,11 @@ def mixed_float():
101
77
102
78
103
79
@pytest .fixture
104
- def mixed_float2 ():
80
+ def mixed_float_frame2 ():
105
81
"""
106
- Fixture for DataFrame of different float types with string index
82
+ Fixture for DataFrame of different float types with index of unique strings
107
83
108
- After completing the fixturization of the frame tests (GH 22471), this
109
- fixture will be renamed to: mixed_float_frame2
110
-
111
- Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
84
+ Columns are ['A', 'B', 'C', 'D'].
112
85
"""
113
86
df = DataFrame (tm .getSeriesData ())
114
87
df .D = df .D .astype ('float16' )
@@ -118,14 +91,11 @@ def mixed_float2():
118
91
119
92
120
93
@pytest .fixture
121
- def mixed_int ():
94
+ def mixed_int_frame ():
122
95
"""
123
- Fixture for DataFrame of different int types with string index
124
-
125
- After completing the fixturization of the frame tests (GH 22471), this
126
- fixture will be renamed to: mixed_int_frame
96
+ Fixture for DataFrame of different int types with index of unique strings
127
97
128
- Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
98
+ Columns are ['A', 'B', 'C', 'D'].
129
99
"""
130
100
df = DataFrame ({k : v .astype (int )
131
101
for k , v in compat .iteritems (tm .getSeriesData ())})
@@ -137,12 +107,9 @@ def mixed_int():
137
107
138
108
139
109
@pytest .fixture
140
- def all_mixed ():
110
+ def mixed_type_frame ():
141
111
"""
142
- Fixture for DataFrame of float/int/string columns
143
-
144
- After completing the fixturization of the frame tests (GH 22471), this
145
- fixture will be renamed to: float_int_string_frame
112
+ Fixture for DataFrame of float/int/string columns with RangeIndex
146
113
147
114
Columns are ['a', 'b', 'c', 'float32', 'int32'].
148
115
"""
@@ -153,12 +120,9 @@ def all_mixed():
153
120
154
121
155
122
@pytest .fixture
156
- def tzframe ():
123
+ def timezone_frame ():
157
124
"""
158
- Fixture for DataFrame of date_range Series with different timezones
159
-
160
- After completing the fixturization of the frame tests (GH 22471), this
161
- fixture will be renamed to: timezone_frame
125
+ Fixture for DataFrame of date_range Series with different time zones
162
126
163
127
Columns are ['A', 'B', 'C']; some entries are missing
164
128
"""
@@ -173,50 +137,34 @@ def tzframe():
173
137
174
138
175
139
@pytest .fixture
176
- def empty ():
140
+ def empty_frame ():
177
141
"""
178
142
Fixture for empty DataFrame
179
-
180
- After completing the fixturization of the frame tests (GH 22471), this
181
- fixture will be renamed to: empty_frame
182
143
"""
183
144
return DataFrame ({})
184
145
185
146
186
147
@pytest .fixture
187
- def ts1 ():
148
+ def datetime_series ():
188
149
"""
189
150
Fixture for Series of floats with DatetimeIndex
190
-
191
- After completing the fixturization of the frame tests (GH 22471), this
192
- fixture will be renamed to: datetime_series
193
-
194
- See pandas.util.testing.makeTimeSeries
195
151
"""
196
152
return tm .makeTimeSeries (nper = 30 )
197
153
198
154
199
155
@pytest .fixture
200
- def ts2 ():
156
+ def datetime_series_short ():
201
157
"""
202
158
Fixture for Series of floats with DatetimeIndex
203
-
204
- After completing the fixturization of the frame tests (GH 22471), this
205
- fixture will be renamed to: datetime_series_short
206
-
207
- See pandas.util.testing.makeTimeSeries
208
159
"""
209
160
return tm .makeTimeSeries (nper = 30 )[5 :]
210
161
211
162
212
163
@pytest .fixture
213
- def simple ():
164
+ def simple_frame ():
214
165
"""
215
166
Fixture for simple 3x3 DataFrame
216
167
217
- After completing the fixturization of the frame tests (GH 22471), this
218
- fixture will be renamed to: simple_frame
219
-
220
168
Columns are ['one', 'two', 'three'], index is ['a', 'b', 'c'].
221
169
"""
222
170
arr = np .array ([[1. , 2. , 3. ],
@@ -232,8 +180,8 @@ def frame_of_index_cols():
232
180
"""
233
181
Fixture for DataFrame of columns that can be used for indexing
234
182
235
- Columns are ['A', 'B', 'C', 'D', 'E']; 'A' & 'B' contain duplicates,
236
- the rest are unique.
183
+ Columns are ['A', 'B', 'C', 'D', 'E']; 'A' & 'B' contain duplicates (but
184
+ are jointly unique), the rest are unique.
237
185
"""
238
186
df = DataFrame ({'A' : ['foo' , 'foo' , 'foo' , 'bar' , 'bar' ],
239
187
'B' : ['one' , 'two' , 'three' , 'one' , 'two' ],
0 commit comments