Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check dictionary values pandas dataframe colu

reverse_dct = {}
for k,v in dct.items():
    for i in v:
        reverse_dct[i] = k

df = pd.DataFrame({'text_column':text_column})
df['word_type'] = df['text_column'].explode().map(reverse_dct).dropna().groupby(level=0).apply(','.join)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #dictionary #values #pandas #dataframe #colu
ADD COMMENT
Topic
Name
5+6 =