'how to insert data from list into excel in python

how to insert data from list into excel in python for example i exported this data from log file :

data= ["101","am1","123450","2015-01-01 11:19:00","test1 test1".....]
      ["102","am2","123451","2015-01-01 11:20:00","test2 test3".....]
      ["103","am3","123452","2015-01-01 11:21:00","test3 test3".....]

Output result: [1]: https://i.stack.imgur.com/7uTOE.png

.



Solution 1:[1]

The module pandas has a DataFrame.to_excel() function that would do that.

import pandas as pd

data= [["101","am1","123450","2015-01-01 11:19:00","test1 test1"],
      ["102","am2","123451","2015-01-01 11:20:00","test2 test3"],
      ["103","am3","123452","2015-01-01 11:21:00","test3 test3"]]

df = pd.DataFrame(data)

df.to_excel('my_data.xmls')

That should do it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1