Right now, will find out about report creation, which is a significant module of light-footed system. Dexterous dashes diagram pages made by representation into out and out reports. With reports, graphs become intelligent, static pages become dynamic and system related information. The attributes of reports phase of the information esteem pyramid is appeared underneath −
We will lay more weight on making csv record, which can be utilized as report for information science investigation, and reaching determination. Albeit lithe focusses on less documentation, creating reports to make reference to the advancement of item improvement is constantly thought of.
import csv
#----------------------------------------------------------------------
def csv_writer(data, path):
"""
Write data to a CSV file path
"""
with open(path, "wb") as csv_file:
writer = csv.writer(csv_file, delimiter=',')
for line in data:
writer.writerow(line)
#----------------------------------------------------------------------
if __name__ == "__main__":
data = ["first_name,last_name,city".split(","),
"Tyrese,Hirthe,Strackeport".split(","),
"Jules,Dicki,Lake Nickolasville".split(","),
"Dedric,Medhurst,Stiedemannberg".split(",")
]
path = "output.csv"
csv_writer(data, path)
The above code will assist you with producing the "csv document" as appeared beneath −
Image
Let us consider the accompanying advantages of csv (comma-isolated qualities) reports −
- It is human cordial and simple to alter physically.
- It is easy to execute and parse.
- CSV can be prepared in all applications.
- It is littler and quicker to deal with.
- CSV observes a standard configuration.
- It gives clear outline to information researchers.