As the title mentions,
diag_code = df.pivot_table('PayabletoProvider',rows='DiagnosisCode',aggfunc=sum)
After applying the pivot function to my df, I am returned with data that dont make sense:
DiagnosisCode ------ PayabletoProvider
002 -------------------- NaN
003 -------------------- NaN
004 -------------------- 1824.70143.80220.001640.2540.00282.00946.31250...
005 -------------------- NaN
006 -------------------- 3324.95432.482400.65
Dont understand why this happens, as results in Excel seem to be ok and sum accordingly.
Would appreciate if somebody can help me fix this problem.
df.info()to check that your columns are the correct type and notobject. Dropping strings without identifying the root of the problem should be a last resort but look here for how.