Closed
Description
The 'pivot' function does not properly handle NaNs. E.g.:
import numpy as np, pandas as pd
test = pd.DataFrame({"a":['R1', 'R2', 'R3', 'R4'], "b":["C1", "C3", np.nan , "C4"], "c":[10, 15, np.nan , 20]})
test.head(2).pivot('a', 'b', 'c')
b C1 C3
a
R1 10 NaN
R2 NaN 15
(No NaNs, works properly)
But:
test.pivot('a', 'b', 'c')
b C1 C3 C4
a
R1 NaN NaN NaN
R2 NaN 10 15
R3 NaN NaN NaN
R4 NaN NaN 20
(Incorrect results, does not crash)
Bug is present in versions 0.8.1 and 0.10.1