@@ -88,83 +88,45 @@ def datetime_table():
88
88
89
89
@pytest .fixture
90
90
def user_table_lk ():
91
- # Link table identified by id and date range ( startdate and enddate)
91
+ # Link table identified by id and startdate
92
92
# Used for query with both equality and inequality conditions
93
93
out = pd .DataFrame (
94
- [
95
- [0 , 0 , 2 , pd .NA , 110 , "a1" , 1.1 , pd .Timestamp ("2001-01-01" )],
96
- [0 , 4 , 6 , pd .NA , 111 , "a2" , 1.2 , pd .Timestamp ("2001-02-01" )],
97
- [1 , 2 , 5 , pd .NA , 112 , "a3" , np .nan , pd .Timestamp ("2001-03-01" )],
98
- [1 , 4 , 6 , 13 , 113 , "a4" , np .nan , pd .Timestamp ("2001-04-01" )],
99
- [3 , 1 , 2 , 14 , 114 , "a5" , np .nan , pd .NaT ],
100
- [3 , 2 , 3 , 15 , 115 , "a6" , 1.6 , pd .NaT ],
101
- ],
102
- columns = [
103
- "id" ,
104
- "startdate" ,
105
- "enddate" ,
106
- "lk_nullint" ,
107
- "lk_int" ,
108
- "lk_str" ,
109
- "lk_float" ,
110
- "lk_date" ,
111
- ],
94
+ [[0 , 5 , 11 , 111 ], [1 , 2 , pd .NA , 112 ], [1 , 4 , 13 , 113 ], [3 , 1 , 14 , 114 ],],
95
+ columns = ["id" , "startdate" , "lk_nullint" , "lk_int" ],
112
96
)
113
97
out ["lk_nullint" ] = out ["lk_nullint" ].astype ("Int32" )
114
- out ["lk_str" ] = out ["lk_str" ].astype ("string" )
115
98
return out
116
99
117
100
118
101
@pytest .fixture
119
102
def user_table_lk2 (user_table_lk ):
120
- # Link table identified by only date range ( startdate and enddate)
103
+ # Link table identified by startdate only
121
104
# Used for query with inequality conditions
122
- return user_table_lk .set_index ("id" ).loc [1 ].reset_index (drop = True )
105
+ out = pd .DataFrame (
106
+ [[2 , pd .NA , 112 ], [4 , 13 , 113 ],], columns = ["startdate" , "lk_nullint" , "lk_int" ],
107
+ )
108
+ out ["lk_nullint" ] = out ["lk_nullint" ].astype ("Int32" )
109
+ return out
123
110
124
111
125
112
@pytest .fixture
126
113
def user_table_ts ():
127
114
# A table of time-series data identified by dates
128
115
out = pd .DataFrame (
129
- [
130
- [3 , pd .NA , 221 , "b1" , 2.1 , pd .Timestamp ("2002-01-01" )],
131
- [4 , 22 , 222 , "b2" , np .nan , pd .Timestamp ("2002-02-01" )],
132
- [7 , 23 , 223 , "b3" , 2.3 , pd .NaT ],
133
- ],
134
- columns = ["dates" , "ts_nullint" , "ts_int" , "ts_str" , "ts_float" , "ts_date" ],
116
+ [[1 , 21 ], [3 , pd .NA ], [7 , 23 ],], columns = ["dates" , "ts_nullint" ],
135
117
)
136
118
out ["ts_nullint" ] = out ["ts_nullint" ].astype ("Int32" )
137
- out ["ts_str" ] = out ["ts_str" ].astype ("string" )
138
119
return out
139
120
140
121
141
122
@pytest .fixture
142
123
def user_table_pn ():
143
124
# A panel table identified by id and dates
144
125
out = pd .DataFrame (
145
- [
146
- [0 , 1 , pd .NA , 331 , "c1" , 3.1 , pd .Timestamp ("2003-01-01" )],
147
- [0 , 2 , pd .NA , 332 , "c2" , 3.2 , pd .Timestamp ("2003-02-01" )],
148
- [0 , 3 , pd .NA , 333 , "c3" , 3.3 , pd .Timestamp ("2003-03-01" )],
149
- [1 , 3 , pd .NA , 334 , "c4" , np .nan , pd .Timestamp ("2003-04-01" )],
150
- [1 , 4 , 35 , 335 , "c5" , np .nan , pd .Timestamp ("2003-05-01" )],
151
- [2 , 1 , 36 , 336 , "c6" , np .nan , pd .Timestamp ("2003-06-01" )],
152
- [2 , 3 , 37 , 337 , "c7" , np .nan , pd .NaT ],
153
- [3 , 2 , 38 , 338 , "c8" , 3.8 , pd .NaT ],
154
- [3 , 2 , 39 , 339 , "c9" , 3.9 , pd .NaT ],
155
- ],
156
- columns = [
157
- "ids" ,
158
- "dates" ,
159
- "pn_nullint" ,
160
- "pn_int" ,
161
- "pn_str" ,
162
- "pn_float" ,
163
- "pn_date" ,
164
- ],
126
+ [[0 , 1 , pd .NA ], [1 , 5 , 32 ], [2 , 1 , 33 ],],
127
+ columns = ["ids" , "dates" , "pn_nullint" ],
165
128
)
166
129
out ["pn_nullint" ] = out ["pn_nullint" ].astype ("Int32" )
167
- out ["pn_str" ] = out ["pn_str" ].astype ("string" )
168
130
return out
169
131
170
132
0 commit comments