This is my situation -
In[1]: data
Out[1]: Item Type
0 Orange Edible, Fruit
1 Banana Edible, Fruit
2 Tomato Edible, Vegetable
3 Laptop Non Edible, ElectronicIn[2]: type(data)
Out[2]: pandas.core.frame.DataFrame
What I want to do is create a data frame of only Fruits
, so I need to groupby
such a way that Fruit
exists in Type
.
I've tried doing this:
grouped = data.groupby(lambda x: "Fruit" in x, axis=1)
I don't know if that's the way of doing it, I'm having a little tough time understanding groupby
. How do I get a new DataFrame
of only Fruits
?