BUG: (GH3588) fix pivoting with nan in the index

closed #3588