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

closed #3558