Grabbing everyone!
Can someone help me with the following problem? Thank you in advance!
I have a CSV file with time stamps (hours, minutes, seconds, milliseconds) and the brightness of the object in values (float), for example:
16.59.55.51 13.8
17,00,17,27 13.7
17,00,39,01 13.6
17.01.01.06 13.4
And here is my python script:
import matplotlib.pyplot as plt
import csv
from datetime import time
x = []
y = []
with open('calibrated.csv','r') as csvfile:
plots = csv.reader(csvfile, delimiter=' ')
for row in plots:
x.append(time(row[0]))
y.append(float(row[1]))
plt.plot(x,y, marker='o', label='brightness')
plt.gca().invert_yaxis()
plt.xlabel('time [UT]')
plt.ylabel('brightness [mag, CR]')
plt.legend()
plt.grid()
plt.show()
When I run the script, I get this TypeError:
Traceback (most recent call last):
File "lightcurve.py", line 11, in
x.append (time (row [0]))
TypeError: an integer is required
What am I doing wrong?
source
share