8
8
9
9
10
10
@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
+ """
12
17
return DataFrame (tm .getSeriesData ())
13
18
14
19
15
20
@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
+ """
17
27
return DataFrame (tm .getSeriesData (), columns = ['D' , 'C' , 'B' , 'A' ])
18
28
19
29
20
30
@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
+ """
22
37
df = DataFrame ({k : v .astype (int )
23
38
for k , v in compat .iteritems (tm .getSeriesData ())})
24
39
# force these all to int64 to avoid platform testing issues
25
40
return DataFrame ({c : s for c , s in compat .iteritems (df )}, dtype = np .int64 )
26
41
27
42
28
43
@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
+ """
30
50
return DataFrame (tm .getTimeSeriesData ())
31
51
32
52
33
53
@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
+ """
35
60
df = DataFrame (tm .getSeriesData ())
36
61
df ['foo' ] = 'bar'
37
62
return df
38
63
39
64
40
65
@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
+ """
42
72
df = DataFrame (tm .getSeriesData ())
43
73
df .A = df .A .astype ('float16' )
44
74
df .B = df .B .astype ('float32' )
@@ -47,7 +77,12 @@ def mixed_float():
47
77
48
78
49
79
@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
+ """
51
86
df = DataFrame (tm .getSeriesData ())
52
87
df .D = df .D .astype ('float16' )
53
88
df .C = df .C .astype ('float32' )
@@ -56,7 +91,12 @@ def mixed_float2():
56
91
57
92
58
93
@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
+ """
60
100
df = DataFrame ({k : v .astype (int )
61
101
for k , v in compat .iteritems (tm .getSeriesData ())})
62
102
df .A = df .A .astype ('uint8' )
@@ -67,15 +107,25 @@ def mixed_int():
67
107
68
108
69
109
@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
+ """
71
116
return DataFrame ({'a' : 1. , 'b' : 2 , 'c' : 'foo' ,
72
117
'float32' : np .array ([1. ] * 10 , dtype = 'float32' ),
73
118
'int32' : np .array ([1 ] * 10 , dtype = 'int32' )},
74
119
index = np .arange (10 ))
75
120
76
121
77
122
@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
+ """
79
129
df = DataFrame ({'A' : date_range ('20130101' , periods = 3 ),
80
130
'B' : date_range ('20130101' , periods = 3 ,
81
131
tz = 'US/Eastern' ),
@@ -87,22 +137,36 @@ def tzframe():
87
137
88
138
89
139
@pytest .fixture
90
- def empty ():
140
+ def empty_frame ():
141
+ """
142
+ Fixture for empty DataFrame
143
+ """
91
144
return DataFrame ({})
92
145
93
146
94
147
@pytest .fixture
95
- def ts1 ():
148
+ def datetime_series ():
149
+ """
150
+ Fixture for Series of floats with DatetimeIndex
151
+ """
96
152
return tm .makeTimeSeries (nper = 30 )
97
153
98
154
99
155
@pytest .fixture
100
- def ts2 ():
156
+ def datetime_series_short ():
157
+ """
158
+ Fixture for Series of floats with DatetimeIndex
159
+ """
101
160
return tm .makeTimeSeries (nper = 30 )[5 :]
102
161
103
162
104
163
@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
+ """
106
170
arr = np .array ([[1. , 2. , 3. ],
107
171
[4. , 5. , 6. ],
108
172
[7. , 8. , 9. ]])
@@ -113,6 +177,12 @@ def simple():
113
177
114
178
@pytest .fixture
115
179
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
+ """
116
186
df = DataFrame ({'A' : ['foo' , 'foo' , 'foo' , 'bar' , 'bar' ],
117
187
'B' : ['one' , 'two' , 'three' , 'one' , 'two' ],
118
188
'C' : ['a' , 'b' , 'c' , 'd' , 'e' ],
0 commit comments