There is much easier way of doing it:
g = x.groupby('Color')
g.groups.keys()
By doing groupby()
pandas returns you a dict of grouped DFs.
You can easily get the key list of this dict by python built in function keys()
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…