Convert pandas Series to DataFrame
to_frame():
Starting with the following Series, df:
emailemail1@email.com Aemail2@email.com Bemail3@email.com Cdtype: int64
I use to_frame to convert the series to DataFrame:
df = df.to_frame().reset_index() email 00 email1@email.com A1 email2@email.com B2 email3@email.com C3 email4@email.com D
Now all you need is to rename the column name and name the index column:
df = df.rename(columns= {0: 'list'})df.index.name = 'index'
Your DataFrame is ready for further analysis.
Update: I just came across this link where the answers are surprisingly similar to mine here.