'Fetch rows if the value is present in list of value in Dataframe's column. Pandas Dataframe column's values are in the list format
Today, I have worked on a similar problem where I need to fetch rows containing a value we are looking for, but the data frame's columns' values are in the list format.
Solution 1:[1]
This is the solution I have come up with.
fetched_rows = df.loc [ df['column_name'].map( lambda x : True if check_element in x else False) == True ]
Where column_name ---> the column name that we need to look into
check_element ---> the value that we use to check whether it exists.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sindhukumari P |
