[SciPy-User] Identify unique sequence data from array

Robert Kern robert.kern@gmail....
Wed Dec 22 13:52:17 CST 2010


On Wed, Dec 22, 2010 at 12:47, otrov <dejan.org@gmail.com> wrote:
> Hi,
> I tried to seek for help on three other lists, but as this problem apparently can't be easily solved in matlab/octave(!?), I thought to try scipy/numpy and maybe gain advantage from python as more feature rich descriptive language
>
> The problem:
>
> I have 2D data sets (scipy/numpy arrays) of 10^7 to 10^8 rows, which consists of repeated sequences of one unique sequence, usually ~10^5 rows, but may differ in scale. Period is same for both columns, so there is not really difference if we consider 2D or 1D array.
> I want to track this data block.

for i in range(1, len(X)-1):
    if (X[i:] == X[:-i]).all():
        break

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


More information about the SciPy-User mailing list