Answers for "how to convert a list to df"

1

how to convert a list into a dataframe in python

from pandas import DataFrame

People_List = ['Jon','Mark','Maria','Jill','Jack']

df = DataFrame (People_List,columns=['First_Name'])
print (df)
Posted by: Guest on October-07-2020
0

list to dataframe

# import pandas as pd
import pandas as pd 
    
# List1 
lst = [['tom', 25], ['krish', 30],
       ['nick', 26], ['juli', 22]]
    
df = pd.DataFrame(lst, columns =['Name', 'Age'])
df
Posted by: Guest on September-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language