Continuation of this and this.
sin or cos, whatever, I just want to plot the external data for the time being!
By the way.
Documents to be submitted can only be accepted in Excel! Write the graph in Excel !!
This is the third time I use rand.txt
.
python
$ perl -le 'print rand (10) for 0 .. 99' > rand.txt
GRAPH.py
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import sys
import matplotlib.pyplot as plt
data = pd.read_csv(sys.argv[1], header=None)
with pd.ExcelWriter(sys.argv[2], engine='xlsxwriter') as writer:
data.to_excel(writer, 'Sheet1')
wb = writer.book
chart = wb.add_chart({'type': 'line'})
en = str(data.shape[0] + 1)
chart.add_series({'categories':'=Sheet1!$A$2:$A$' + en, 'values': '=Sheet1!$B$2:$B$' + en })
writer.sheets['Sheet1'].insert_chart('C1', chart)
python
$ python GRAPH.py rand.txt graph.xlsx
--XlsxWriter
will be automatically entered if ʻAnaconda is installed, but it needs to be installed separately in the environment where
pandas` is manually installed [^ 1].
[^ 1]: Lightly fitted with this.
Recommended Posts