How is a Pandas crosstab different from a Pandas pivot_table?
问题 Both the pandas.crosstab and the Pandas pivot table seem to provide the exact same functionality. Are there any differences? 回答1: The main difference between the two is the pivot_table expects your input data to already be a DataFrame; you pass a DataFrame to pivot_table and specify the index / columns / values by passing the column names as strings. With cross_tab , you don't necessarily need to have a DataFrame going in, as you just pass array-like objects for index / columns / values .