@@ -165,10 +165,6 @@ def pd_arrow_dtypes() -> Generator:
165
165
166
166
# Integer
167
167
dtypes = pandas_pyarrow_mapper
168
- Null : Union [float , None , Any ] = np .nan
169
- orig = pd .DataFrame (
170
- {"f0" : [1 , 2 , Null , 3 ], "f1" : [4 , 3 , Null , 1 ]}, dtype = np .float32
171
- )
172
168
# Create a dictionary-backed dataframe, enable this when the roundtrip is
173
169
# implemented in pandas/pyarrow
174
170
#
@@ -191,24 +187,33 @@ def pd_arrow_dtypes() -> Generator:
191
187
# pd_catcodes = pd_cat_df["f1"].cat.codes
192
188
# assert pd_catcodes.equals(pa_catcodes)
193
189
194
- for Null in (None , pd .NA ):
190
+ for Null in (None , pd .NA , 0 ):
195
191
for dtype in dtypes :
196
192
if dtype .startswith ("float16" ) or dtype .startswith ("bool" ):
197
193
continue
194
+ # Use np.nan is a baseline
195
+ orig_null = Null if not pd .isna (Null ) and Null == 0 else np .nan
196
+ orig = pd .DataFrame (
197
+ {"f0" : [1 , 2 , orig_null , 3 ], "f1" : [4 , 3 , orig_null , 1 ]},
198
+ dtype = np .float32 ,
199
+ )
200
+
198
201
df = pd .DataFrame (
199
202
{"f0" : [1 , 2 , Null , 3 ], "f1" : [4 , 3 , Null , 1 ]}, dtype = dtype
200
203
)
201
204
yield orig , df
202
205
203
- orig = pd .DataFrame (
204
- {"f0" : [True , False , pd .NA , True ], "f1" : [False , True , pd .NA , True ]},
205
- dtype = pd .BooleanDtype (),
206
- )
207
- df = pd .DataFrame (
208
- {"f0" : [True , False , pd .NA , True ], "f1" : [False , True , pd .NA , True ]},
209
- dtype = pd .ArrowDtype (pa .bool_ ()),
210
- )
211
- yield orig , df
206
+ # If Null is `False`, then there's no missing value.
207
+ for Null in (pd .NA , False ):
208
+ orig = pd .DataFrame (
209
+ {"f0" : [True , False , Null , True ], "f1" : [False , True , Null , True ]},
210
+ dtype = pd .BooleanDtype (),
211
+ )
212
+ df = pd .DataFrame (
213
+ {"f0" : [True , False , Null , True ], "f1" : [False , True , Null , True ]},
214
+ dtype = pd .ArrowDtype (pa .bool_ ()),
215
+ )
216
+ yield orig , df
212
217
213
218
214
219
def check_inf (rng : RNG ) -> None :
0 commit comments