Answers for "save list to dataframe python"

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

pandas save dataframe with list

"""
  write/read your pandas.DataFrame as a pickle (.pkl) file
  to keep the list data structure
"""

# write
df.to_pickle('path/to/filename.pkl')

# read
df.read_picke('path/to/filename.pkl')
Posted by: Guest on May-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language