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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started