Lists: Converting Double to Single

rshepard at nospam.appl-ecosys.com rshepard at nospam.appl-ecosys.com
Mon Feb 26 19:55:23 EST 2007


  I start with a list of tuples retrieved from a database table. These
tuples are extracted and put into individual lists. So I have lists that
look like this: [1, 2, 3, 4, 5]. When I concatenate lists, I end up with a
list of lists that looks like this: [[1, 2, 3. 4, 5]. [6, 7. 8, 9. 10]].
Then, I average the column values so I end up with a single list, but with
two brackets on each end, for example, [[3.5, 4.5, 5.5, 6.5, 7.5]].

  Unfortunately, when I try to use that last list in a NumPy function, I'm
told that it cannot be broadcast to the correct shape. So, what I want to do
is strip the extra brackes from each end to leave just [3.5, 4.5, 5.5, 6.5,
7.5].

  How do I do this, please?

Rich



More information about the Python-list mailing list