When looking for a solution to my previous question (which was clearly resolved), I had another problem that has not yet been resolved. I would be very grateful to everyone who could help me solve this problem!
There was a thought that I used the outdated version of matplotlib 1.5.1, but now I upgraded it to 2.1.1, as well as from numpy to 1.14.0, this did not help me, alas.
So again. I have a CSV file as input:
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 I ran this python script on it:
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:
hours,minutes,seconds,milliseconds = [int(s) for s in row[0].split(",")]
x.append(time(hours,minutes,seconds,milliseconds))
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()
And I get this TypeError on it (while the person who solved my previous question doesn't have it!):
Traceback (most recent call last):
File "lightcurve.py", line 16, in <module>
plt.plot(x,y, marker='o', label='brightness')
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 3154, in plot
ret = ax.plot(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1812, in inner
return func(ax, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 1425, in plot
self.add_line(line)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1708, in add_line
self._update_line_limits(line)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1730, in _update_line_limits
path = line.get_path()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/lines.py", line 925, in get_path
self.recache()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/lines.py", line 612, in recache
x = np.asarray(xconv, np.float_)
File "/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: float() argument must be a string or a number
I'm stuck there.