I have the following code which takes a csv string and saves it as an excel file. I would like to plot a line graph out of this csv, excluding some columns and using the only string column as x axis (all other columns are numbers). Creating this graph in excel is a simple three steps procedure:
- Marking the relevant rows
- Click on instert
- Click on line chart
However, I couldnt find a way to do it in python.
Here is my code:
def save_to_excel(csv, type):
csv_data_frame = pd.read_csv(StringIO(csv))
excel_file = pd.ExcelWriter(f"{type}_results.xlsx", engine='openpyxl')
csv_data_frame.to_excel(excel_file, index=False, sheet_name="results")
with excel_file:
pass
Can anyone assist in finding an elegant way to go about this?