pivot is used for reshaping data and cannot handle duplicate values for the specified columns. pivot_table can perform aggregations when you have duplicate entries.