Groupby is more flexible and can handle any function, while pivot_table is more convenient and can create a table with hierarchical rows and columns. Groupby can also group by multiple levels, while pivot_table can only group by one level.