Hi, I am new with numpy and scipy. But I have a problem to find a good way to compute my array. I have a array with 2 rows. Example [[5, 8, 9, 10], [1, 2, 3, 5,6]] And I need to manage the number of records without touch the "behaviour" of my array. Example: Reduce my to 2 columns => [[5, 10],[1,6]] Who knows which sort of algorithms I need to make it ? Regards -- Didier Rano didier.rano@gmail.com http://www.jaxtr.com/didierrano
On Fri, Mar 21, 2008 at 12:10 PM, didier rano <didier.rano@gmail.com> wrote:
Hi,
I am new with numpy and scipy. But I have a problem to find a good way to compute my array. I have a array with 2 rows. Example [[5, 8, 9, 10], [1, 2, 3, 5,6]]
Note that this cannot be a valid numpy array since the second row has more elements than the first. I will move forward with the assumption that you did not intend the "5" element.
And I need to manage the number of records without touch the "behaviour" of my array. Example: Reduce my to 2 columns => [[5, 10],[1,6]]
Who knows which sort of algorithms I need to make it ?
In [3]: a = array([[5, 8, 9, 10], [1, 2, 3, 6]]) In [4]: a Out[4]: array([[ 5, 8, 9, 10], [ 1, 2, 3, 6]]) In [5]: a[:,[0,-1]] Out[5]: array([[ 5, 10], [ 1, 6]]) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Thank you for your answer. And yes, I forgot a number in my first row ! In fact, I think that it wasn't a good example. I need more a sampling algorithm or similar. My second row will be a time series, but not always regular i.e. with some holes (In my example, '4' is missing). Didier Rano 2008/3/21, Robert Kern <robert.kern@gmail.com>:
On Fri, Mar 21, 2008 at 12:10 PM, didier rano <didier.rano@gmail.com> wrote:
Hi,
I am new with numpy and scipy. But I have a problem to find a good way to compute my array. I have a array with 2 rows. Example [[5, 8, 9, 10], [1, 2, 3, 5,6]]
Note that this cannot be a valid numpy array since the second row has more elements than the first. I will move forward with the assumption that you did not intend the "5" element.
And I need to manage the number of records without touch the "behaviour" of my array. Example: Reduce my to 2 columns => [[5, 10],[1,6]]
Who knows which sort of algorithms I need to make it ?
In [3]: a = array([[5, 8, 9, 10], [1, 2, 3, 6]])
In [4]: a Out[4]: array([[ 5, 8, 9, 10], [ 1, 2, 3, 6]])
In [5]: a[:,[0,-1]] Out[5]: array([[ 5, 10], [ 1, 6]])
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
-- Didier Rano didier.rano@gmail.com http://www.jaxtr.com/didierrano
On Friday 21 March 2008 21:11:29 didier rano wrote:
Thank you for your answer. And yes, I forgot a number in my first row !
In fact, I think that it wasn't a good example. I need more a sampling algorithm or similar. My second row will be a time series, but not always regular i.e. with some holes (In my example, '4' is missing).
Shameless plug: Try scikits.timeseries. http://scipy.org/scipy/scikits/wiki/TimeSeries It's a package designed to handle series indexed in time with missing data and/or missing dates, that looks like what you need. Send me a message if you need more help. Cheers
participants (3)
-
didier rano
-
Pierre GM
-
Robert Kern