-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Milestone
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
Metadata
Metadata
Assignees
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves