File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ cdef inline _isnan(object o):
227
227
return o != o
228
228
229
229
cdef inline _checknull(object val):
230
- if isinstance (val, float ):
230
+ if isinstance (val, ( float , np.floating) ):
231
231
return val != val or val == INF or val == NEGINF
232
232
else :
233
233
return val is None
Original file line number Diff line number Diff line change @@ -1548,6 +1548,17 @@ def test_to_csv_multiindex(self):
1548
1548
1549
1549
os .remove (path )
1550
1550
1551
+ def test_to_csv_float32_nanrep (self ):
1552
+ df = DataFrame (np .random .randn (1 , 4 ).astype (np .float32 ))
1553
+ df [1 ] = np .nan
1554
+
1555
+ pth = '__tmp__.csv'
1556
+ df .to_csv (pth , nanRep = 999 )
1557
+
1558
+ lines = open (pth ).readlines ()
1559
+ self .assert_ (lines [1 ].split (',' )[2 ] == '999' )
1560
+ os .remove (pth )
1561
+
1551
1562
def test_info (self ):
1552
1563
io = StringIO ()
1553
1564
self .frame .info (buf = io )
You can’t perform that action at this time.
0 commit comments