Closed
Description
The documentation for merging categorical arrays (here) states that calling pd.concat
on two data frames with categorical columns will throw an error. This doesn't throw an error, and probably shouldn't following #13767.
Here's the example shown in the docs:
import pandas as pd
cat = pd.Series(["a", "b"], dtype="category")
vals = [1, 2]
df = pd.DataFrame({"cats": cat, "vals": vals})
df_different = df.copy()
df_different["cats"].cat.categories = ["c", "d"]
try:
pd.concat([df, df_different])
except ValueError as e:
print("ValueError:", str(e))