In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Most people do not understand the knowledge points of this article "python how to write the data into the list and derive the line chart", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "python how to write data into the list and export the line chart" article.
Import csvdatas = [['Commodity name', 'Monday sales', 'Tuesday sales', 'Wednesday sales', 'Thursday sales', 'Friday sales', 'Saturday sales', 'Sunday sales'], ['washing machines','2','2','2','2', 3', 2', 4', 5'], ['refrigerator','1','2' ['air conditioners', '3percent,' 4percent, '3percent,' 4percent, '4percent,' 3percent, '6percent,' 5'] # 'goods name', 'Monday sales', 'Tuesday sales', 'Wednesday sales', 'Thursday sales', 'Friday sales', 'Saturday sales' On Sunday, they sell washing machines, washing machines, refrigerators, air conditioners, air conditioners. Change to the path where your current project is located and create the corresponding file # [1, 2, 3, 2, 2, 4, 5, 4], with open ('Dju _ peg _ Usert _ for row in datas _ writer.writerow _ row) as csvfile: writer = csv.writer (csvfile) for row in datas: writer.writerow (row)
Generate a line chart:
Import matplotlib.pyplot as pltimport numpy as npimport matplotlib.pyplot as pltplt.rcParams ['font.sans-serif'] = [' SimHei'] # to display the Chinese label plt.rcParams ['axes.unicode_minus'] = False # these two lines need to be manually set up for plt.plot ("D:/Users/admin/PycharmProjects/pythonProject/example_csv.txt", delimiter= ",", unpack=True) plt.plot (xmemy) Label= "Air conditioning sales quantity") plt.xlabel ("x") plt.ylabel ("y") plt.title ("sales Line Chart") plt.legend () plt.show ()
The above is about the content of this article on "how python writes data into the list and derives the line chart". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.