Hi, I have a numpy array ('data') that is the result of reading a netCDF file, and it typically looks like this:
array([ 0., 0., 0., 0.], dtype=float32) I want to write this, after a date and time, to a CSV file, so the CSV file would have the entry: 2000-02-01,09:00,0.0,0.0,0.0,0.0 The code I'm using to test it, is: # file_details[0] is the date and file_details[1] is the time writer.writerow(('%s' % (file_details[0]),'%s' % (file_details[1]),'%f' % (data[0]))) In my opinion, this should give an output line: 2000-02-01,09:00,0.0 Instead, I get an error TypeError: float argument required, not numpy.ndarray Can someone please explain to me why data[0] is giving a numpy array rather than one element? I don't understand it, since I get: >>> data[0] 0.0 Thanks Hanlie _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor