Python Pandas DataFrame: Split variable text column and then count -
i have column in database each cell having list of e-mail addresses separated commas. each cell has different numbers of e-mail addresses. trying figure out e-mail address common overall.
i thinking combine these cells 1 cell, , split thm comma, , use counter function find used e-mail address. getting stuck @ first step. there way combine everything?
in[0] import pandas pd in[1] data = pd.series(["abc@def.com,pqr@def.com", "abc@def.com", "abc@def.com,xyz@def.com,pqr@def.com"]) in[3]: data = pd.dataframe(data, columns=["emails"]) in[4]: pd.series(data.emails.str.split(',', expand=true).values.ravel()).mode().values[0] out[4]: 'abc@def.com'
Comments
Post a Comment