finding repeated data sequences in a column

yadin conra2004 at yahoo.com
Wed May 20 17:55:25 CEST 2009


On May 20, 11:16 am, bearophileH... at lycos.com wrote:
> yadin, understanding what you want is probably 10 times harder than
> writing down the code :-)
>
> > I have a a table, from where I can extract a column.
>
> You can extract it? Or do you want to extract it? Or do you want to
> process it? Etc.
>
> > I wanna go down trough that column made of numbers
> > examine undetermined chunks ofdataand see or detect if that sequence
> > of chunk
> > ofdatahas beenrepeatedbefore
>
> What do you mean by "undetermined"? What kind ofdata? Where is thisdata? How is this "chunk" shaped? Are you talking about a string?
>
> > and if it has beenrepeateddetect it by giving it a name in an
> > adjacent column.
>
> What kind of name? So you just need 2 names, like N and S for New and
> Seen?
> You can use a built-in setdatastructure to know if you have already
> seen somedata, while you scan the records.
>
> > Imagine someting like this but made of 1800 numbers...
>
> How are such 1800 disposed? Do you mean 1800 columns of 32 bit
> numbers?
>
> > how can I build up column 3(category)<
>
> What does A, B and C mean?
>
> Bye,
> bearophile

lets say you have this column of numbers

1000028706
1000028707
1000028708
100
12
1000028706
1000028707
1000028708
1000028709
1000028706
1000028707
1000028708
100
12
6

How can I build up a program that tells me that this sequence
1000028706
1000028707
1000028708
is repeated somewhere in the column, and how can i know where?

thank you very much!



More information about the Python-list mailing list