File tree 3 files changed +2
-19
lines changed
3 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -534,19 +534,6 @@ def ensure_float(arr):
534
534
535
535
return arr
536
536
537
- def ensure_nansafe (arr ):
538
- """
539
- convert int to float
540
- convert bool to object
541
- """
542
- if issubclass (arr .dtype .type , np .integer ):
543
- arr = arr .astype (float )
544
-
545
- elif issubclass (arr .dtype .type , np .bool_ ):
546
- arr = arr .astype (object )
547
-
548
- return arr
549
-
550
537
def _mut_exclusive (arg1 , arg2 ):
551
538
if arg1 is not None and arg2 is not None :
552
539
raise Exception ('mutually exclusive arguments' )
Original file line number Diff line number Diff line change @@ -3567,7 +3567,7 @@ def _shift_block(blk, indexer):
3567
3567
new_values = blk .values .take (indexer , axis = 1 )
3568
3568
# convert integer to float if necessary. need to do a lot more than
3569
3569
# that, handle boolean etc also
3570
- new_values = com .ensure_nansafe (new_values )
3570
+ new_values = com ._maybe_upcast (new_values )
3571
3571
if periods > 0 :
3572
3572
new_values [:, :periods ] = nan
3573
3573
else :
Original file line number Diff line number Diff line change @@ -157,11 +157,7 @@ def get_new_values(self):
157
157
new_values = np .empty ((length , result_width ), dtype = values .dtype )
158
158
new_mask = np .zeros ((length , result_width ), dtype = bool )
159
159
160
- if issubclass (values .dtype .type , np .integer ):
161
- new_values = new_values .astype (float )
162
- elif issubclass (values .dtype .type , np .bool_ ):
163
- new_values = new_values .astype (object )
164
-
160
+ new_values = com ._maybe_upcast (new_values )
165
161
new_values .fill (np .nan )
166
162
167
163
# is there a simpler / faster way of doing this?
You can’t perform that action at this time.
0 commit comments