Blog https://www.cnblogs.com/en-heng/p/5630849.html describes how to use Pandas for data analysis
ImportPandas as PD#any number of groups of listsA = [A.]b= [4,5,6] #the key value in the dictionary is the column name in the CSVDataframe = PD. DataFrame ({'A_name'A'B_name': b})#storing Dataframe as Csv,index indicates whether the row name is displayed, Default=trueDataframe.to_csv ("Test.csv", index=false,sep=',')
Import= pd.read_csv ('test.csv')
ImportCSV#Python2 can replace open with fileWith open ("Test.csv","W") as Csvfile:writer=Csv.writer (csvfile)#Write Columns_name FirstWriter.writerow (["Index","A_name","B_name"]) #write multiple lines with writerowsWriter.writerows ([[0,1,3],[1,2,3],[2,3,4]])
Import Csvwith Open ("test.csv","R") as CSVFile: = Csv.reader (csvfile) # This does not require ReadLines for Reader: Print Line
Python read/write CSV file