BUG: replace coerces incorrect dtype
closes #12747

Author: sinhrks <sinhrks@gmail.com>

This patch had conflicts when merged, resolved by
Committer: Jeff Reback <jeff@reback.net>

closes #15742
Closes #12780 from sinhrks/replace_type and squashes the following commits:

f9154e8 [sinhrks] remove unnecessary comments
279fdf6 [sinhrks] remove import failure
de44877 [sinhrks] BUG: replace coerces incorrect dtype