Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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

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

how to convert a list to dataframe in python

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

change dataframe to list

df.values.tolist()
Comment

PREVIOUS NEXT
Code Example
Python :: loop indexing 
Python :: view all columns pandas 
Python :: np array to list 
Python :: double char python 
Python :: pandas convert first row to header 
Python :: not null constraint failed django 
Python :: php echo shorthand 
Python :: python os get path 
Python :: django only certain columns from database 
Python :: numpy random matrix 
Python :: ord python 
Python :: pil.jpegimageplugin.jpegimagefile to image 
Python :: how to delete an item from a list python 
Python :: python Modulo 10^9+7 (1000000007) 
Python :: how to create a set from a list in python 
Python :: get last 3 in list python 
Python :: iterate over dataframe 
Python :: insert into string python more than one 
Python :: matplotlib different number of subplots 
Python :: django reverse function 
Python :: sentence similarity spacy 
Python :: python equals override 
Python :: python extract list from string 
Python :: sum of 1 to even numbers in python 
Python :: get names of all file in a folder using python 
Python :: pairplot with selected field 
Python :: python pip Failed to build cryptography 
Python :: pytorch load pt file 
Python :: how to find unique values in list in python 
Python :: python terminal game 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =