Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Converting Dataframe from list Using a list in the dictionary

# import pandas as pd 

import pandas as pd 
# list of name, degree, score 
n = ["apple", "grape", "orange", "mango"] 
col = ["red", "green", "orange", "yellow"] 
val = [44, 33, 22, 11] 
# dictionary of lists 
dict = {'fruit': n, 'color': col, 'value': val}  
df = pd.DataFrame(dict) 
print(df)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Converting #Dataframe #list #Using #list #dictionary
ADD COMMENT
Topic
Name
2+3 =