I have a dataframe like this:
I'm trying to get the index given the following conditions in the column 'Product':
- That the value is a string.
- That the value doesn't contain a comma.
This is what I'm trying now:
product_list = []
for i in data['Product']:
if(isinstance(i, str)):
if "," not in i:
product_list.append(data['Product'].index)
If the value of the cell is a string, and there isn't a comma, append the index to the list. But I can't get the index this way.
If the condition were easier, just by looking up by one type of product, I could have obtained it this way:
data.index[data['Products']=='A'].tolist()
Is there any similar way to do it?