pivot_table() builds a pivot table: one column provides the rows, another the columns, and an aggregation function summarizes the values at their intersection. The margins parameter adds totals and fill_value replaces empty cells. It is the equivalent of a spreadsheet pivot table.
Example
pd.pivot_table(df, index='pays', columns='annee', values='ca', aggfunc='sum')