Hello, I have a question because the Python assignment is difficult.
As shown in the screenshot above, each of the four files contains a Pushoverput folder from 00 to 20. Inside this folder are the out files of Node2 and Node4. At this time, the task is to make a code on the Python using the data in column 2 of Node 2 and column 6 of Node 4, draw a graph, and save it in the Figures folder.
In this process, I would like to know a code that can store a total of 22 graphs in the Figures folder, including 00 to 20 graphs using the for statement and a graph with 21 graphs drawn at the same time.
I separately extracted data from 00 of 0.5H folders and made a csv file, and I know how to load this file, but I don't know what's next.python
Hmm. I'll write a very simple example code as an answer.
To access a few columns in the Pandas DataFrame, use
iloc. Create a data frame by combining two data frames, node2 and node4, into the second (one for index) and sixth (five for index). Then, in a two-column data frame, you draw a graph as a plot function of Pandas.
And then finally, we store that graph as a function of
plt.savefig. It might be a little confusing here, but it's plt.savefig because the panda plot function uses matplotlib internally to render.
If you want to adjust the details of the graph, you can study matplotlib a little more.
© 2022 pinfo. All rights reserved.