PERF: rendering of large number of categories · Issue #11305 · pandas-dev/pandas (original) (raw)

xref #11304

items = [str(i) for i in range(40000)]
s = pd.Series(items, dtype='category')
df = pd.DataFrame({'C':s, 'data':np.random.randn(40000)})
data = df[df.C=='20']
str(data.C)

This renders the string of all of the categories before chopping them, see here

This should check for a large number of categories first, then render the chopped portions.