Question: Hello. I am working on a project where I have to graph data from my python program into excel. I am exporting the data into

Hello. I am working on a project where I have to graph data from my python program into excel. I am exporting the data into a .csv file but my problem is that the data is not separated by commas which is making it hard to put into excel without manually entering all the commas. B/c of how new I am in the class we are not using matplotlib, so I have to do it manually. Any help is greatly appreciated. My code is below:

import numpy as np

import csv

x = np.arange(-2*np.pi,2*np.pi,np.pi/64).astype(int)

y = np.sin(x).astype(int)

z=np.cos(x).astype(int)

print(x,y,x,z)

x1=np.arange(1,200,0.5).astype(int)

y1=np.sqrt(x1).astype(int)

z1=np.log10(x1).astype(int)

print(x1,y1,x1,z1)

with open("Lab2.csv", "w", newline= '') as f:

graph = csv.writer(f)

graph.writerow([x,y,x,z])

graph.writerow([x1,y1,x1,z1])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!