# Algorith that determinates frequency of string combinations from csv file

17
2014.02.14 07:52

I have csv file like this:

```1392249600;EUR;CHF;USD;JPY;GBP
1392163200;GBP;JPY;USD;CHF;EUR
1392076800;GBP;CHF;EUR;JPY;USD
1391990400;JPY;USD;EUR;CHF;GBP
1391904000;GBP;EUR;CHF;USD;JPY
1391731200;GBP;EUR;CHF;JPY;USD
1391644800;EUR;CHF;USD;JPY;GBP
1391558400;JPY;USD;EUR;CHF;GBP
```

There can be over 15 000 rows in that file. I am trying to write code that could do such thing:

1.Takes first row saves it as parent. Then takes next 3 days as that childs.

2.Counts how often and which combination off childs with that parent are inside this file.

3.It creates something like summary for that so I could read todays combination and script shows the only the most frequent child combinations for next 3 days.

I don't have mathematical thinking so I have big problems to find solution myself.

What I think first I need script that generates all posible combinations of these colums made of EUR,CHF,USD,JPY,GBP so there is posible 5*4*3*2*1 = 120 combinations. Because they cant repeat in single row.

It will be like this.

First parent will be combination from first row like this: EUR;CHF;USD;JPY;GBP

```Then 3 childs would be
GBP;JPY;USD;CHF;EUR
GBP;CHF;EUR;JPY;USD
JPY;USD;EUR;CHF;GBP
```

It saves this combination off parent and child elements. Then again it starts from begining of the file, but moves one row below(like iteration +1). then next all childs would be

``` GBP;CHF;EUR;JPY;USD
JPY;USD;EUR;CHF;GBP
GBP;EUR;CHF;USD;JPY
```

And again it saves these combinations for counting and make some frequency results. And this cycle repeats for all rows on csv file.

Is there maybe some tips I should consider how to create this type of programm ?

Any tip would be great !

Thank You Very Much! BB

Moderator
30214
2014.02.14 10:34

Hi,

Can you show what you have tried so far ?

17
2014.02.14 11:07
angevoyageur:

Hi,

Can you show what you have tried so far ?

I haven't tried put to work some code, I am just trying to understand what things I should consider. So planning is the key. :)
Moderator
30214
2014.02.14 18:28
edzuks92:

I haven't tried put to work some code, I am just trying to understand what things I should consider. So planning is the key. :)