Skip to content

Commit

Permalink
COMPAT: older numpies compat on dtype upcasting, xref #10503
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Feb 27, 2016
1 parent ef6de76 commit cb43b2f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,23 @@ def _is_empty_indexer(indexer):
block = block.convert(numeric=False)

return block
except (ValueError, TypeError):
except ValueError:
raise
except TypeError:

# cast to the passed dtype if possible
# otherwise raise the original error
try:
# e.g. we are uint32 and our value is uint64
# this is for compat with older numpies
block = self.make_block(transf(values.astype(value.dtype)))
return block.setitem(indexer=indexer, value=value, mgr=mgr)

except:
pass

raise

except Exception:
pass

Expand Down

0 comments on commit cb43b2f

Please sign in to comment.