'how to get access to a list of items in a cell in pandas
I have a data frame in pandas including several columns, I need to get access to the one cell which contains a list of items, how would it be possible? (e.g. how to get access to Match elements in the following example)
ID Match
1 (word1,,,)
2 (word2,,,),(word1)
3 (word2,,,),(word1),(word3,,,)
Solution 1:[1]
Leveraging the above answer, my problem is that I also had a column with a list.
if your table looks something like
Idx Words 1 ['word1', 'word2'] 2 ['word2', 'word3', 'word4']
and you want all the rows where the word "word2" exists
df_result = df_words[ df_words['Words'].str[0] == 'word1']
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 | QuentinJS |
