Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

List to Dataframe

# import pandas as pd 

import pandas as pd 
# list of strings 
lst = ['fav', 'tutor', 'coding', 'skills']
# Calling DataFrame constructor on list 
df = pd.DataFrame(lst) 
print(df) 
Comment

how to convert a list to dataframe in python

import pandas as pd
from pandas import DataFrame
df = DataFrame(lst,columns=['num'])
Comment

convert list to dataframe

L = ['Thanks You', 'Its fine no problem', 'Are you sure']

#create new df 
df = pd.DataFrame({'col':L})
print (df)

                   col
0           Thanks You
1  Its fine no problem
2         Are you sure
Comment

convert list of lists to pandas dataframe

salary = [['Company', 'Job', 'Salary($)'],
          ['Google', 'Machine Learning Engineer', 121000],
          ['Google', 'Data Scientist', 109000],
          ['Google', 'Tech Lead', 129000],
          ['Facebook', 'Data Scientist', 103000]]
df = pd.DataFrame(salary[1:], columns=salary[0])
Comment

PREVIOUS NEXT
Code Example
Python :: django form password field 
Python :: pandas dataframe convert nan to string 
Python :: bgr to gray opencv 
Python :: limit axis matplotlib 
Python :: tkinter boilerplate 
Python :: python server http one line 
Python :: read video with opencv 
Python :: column standardization pandas 
Python :: plt line of best fit 
Python :: python check operating system 
Python :: how to update sklearn using conda 
Python :: opencv python convert rgb to hsv 
Python :: Connecting Kaggle to Google Colab 
Python :: droaw heat map in python for null values 
Python :: python os.getenv not working 
Python :: cv2 hconcat 
Python :: get next multiple of a number 
Python :: 1 eth to wei 
Python :: brownie to wei 
Python :: fraction thesis 
Python :: datetime 30 days ago python 
Python :: pandas reciprocal 
Python :: required validator python WTForms 
Python :: Find the value in column in pandas 
Python :: how to change voice of pyttsx3 
Python :: python input comma separated values 
Python :: selenium get current url 
Python :: nodemon python 
Python :: python tkinter clear textbox 
Python :: read image python 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =