Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Series constructor doesn't validate / reindex categorical #19342
In : import pandas as pd In : c = pd.Series(pd.Categorical(['a', 'a']), index=[0, 1, 2]) In : c Out: 0 a 1 a 2 dtype: category Categories (1, object): [a] In : len(c) Out: 3 In : len(c.values) Out: 2
This should probably raise.
I'm going to make a pull request for this one, but just wanted to check on the strategy, in case I'm missing something else.
This appears to be an issue just for Categoricals in Series. Attempting to make a DataFrame of Categoricals with a mismatched index raises as expected. The issue is due to the fact that