Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Pandas pivot table

table = pd.pivot_table(df, values='D', index=['A', 'B'],
...                     columns=['C'], aggfunc=np.sum)
>>> table
C        large  small
A   B
bar one    4.0    5.0
    two    7.0    6.0
foo one    4.0    1.0
    two    NaN    6.0
Source by pandas.pydata.org #
 
PREVIOUS NEXT
Tagged: #Pandas #pivot #table
ADD COMMENT
Topic
Name
6+4 =