Closed
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
df = pd.DataFrame({'a': [1, 1, 2], 'b': [3, 4, 5]})
print(pd.crosstab(df["a"].to_list(), df["b"].to_list()))
Issue Description
The example raises a ValueError, whereas using to_numpy
instead of to_list
successfully produces the correct output. This is due to the use of maybe_make_list
treating lists/tuples differently than other list-likes, and is related to #44056.
Expected Behavior
col_0 3 4 5
row_0
1 1 1 0
2 0 0 1
Installed Versions
Replace this line with the output of pd.show_versions()