How to keep only the x first terms of an array(numpy)?

Hello,

Do somebody knows how to keep only the x first terms of a numpy 1D array?

like

a = array([8,4,5,7,9])
function(a,2)

···

[8,4]

These questions belong on the numpy mailing list. You have already asked this question on scipy-user and received a correct answer.

   http://www.scipy.org/Mailing_Lists

···

On 1/30/12 3:50 PM, Fabien Lafont wrote:

Hello,

Do somebody knows how to keep only the x first terms of a numpy 1D array?

like

a = array([8,4,5,7,9])
function(a,2)

[8,4]

--
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