File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -1271,14 +1271,23 @@ def _possibly_downcast_to_dtype(result, dtype):
1271
1271
dtype = np .dtype (dtype )
1272
1272
1273
1273
try :
1274
-
1275
1274
# don't allow upcasts here (except if empty)
1275
+ print dtype .kind , result .dtype .kind
1276
1276
if dtype .kind == result .dtype .kind :
1277
1277
if result .dtype .itemsize <= dtype .itemsize and np .prod (result .shape ):
1278
1278
return result
1279
1279
1280
1280
if issubclass (dtype .type , np .floating ):
1281
1281
return result .astype (dtype )
1282
+
1283
+ # a datetimelike
1284
+ elif ((dtype .kind == 'M' and result .dtype .kind == 'i' ) or
1285
+ dtype .kind == 'm' ):
1286
+ try :
1287
+ result = result .astype (dtype )
1288
+ except :
1289
+ pass
1290
+
1282
1291
elif dtype == np .bool_ or issubclass (dtype .type , np .integer ):
1283
1292
1284
1293
# if we don't have any elements, just astype it
@@ -1309,13 +1318,6 @@ def _possibly_downcast_to_dtype(result, dtype):
1309
1318
if (new_result == result ).all ():
1310
1319
return new_result
1311
1320
1312
- # a datetimelike
1313
- elif dtype .kind in ['M' ,'m' ] and result .dtype .kind in ['i' ]:
1314
- try :
1315
- result = result .astype (dtype )
1316
- except :
1317
- pass
1318
-
1319
1321
except :
1320
1322
pass
1321
1323
You can’t perform that action at this time.
0 commit comments