hi all,
i am reading a set of tab-separated data from a file and i want to put it
into an array, and then plot some of the columns. i know the number of
columns ahead of time but not the number of rows. i load the array from the
file as follows, which seems to work:
data = []
for line in myfile:
field1, field2, field3 = line.strip().split('\t')
data.append([int(field1), int(field2), int(field3)])
i then convert it into an array as follows:
data = array(data)
i am able to reference the first column as follows:
data[:,0]
but if i try to plot the first column against the second as follows:
bar(data[:,0],data[:,1])
then i get the error:
/usr/lib64/python2.5/site-packages/matplotlib/units.pyc in
get_converter(self, x)
128 converter = self.get(classx)
129
--> 130 if converter is None and iterable(x):
131 # if this is anything but an object array, we'll assume
132 # there are no custom units
[repeated many times]
RuntimeError: maximum recursion depth exceeded
WARNING: Failure executing file: <myfile.py>
how can i fix this? i'd like an n-by-m representation of my data as an array
which i can reference like a matrix in matlab. some of the columns are
floats, other are ints, and others are strings, so i prefer to load the data
into an array as a loop where i can cast the strings appropriately, rather
than use some built in io function for reading tab-separated data.
thank you very much.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users