Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have following structure
$data = { 1990 => [ 1,2,3], 1991 => [2,3,5], 1992 => [1,2,7,9], .... };
Assume that keys are 'years' and lists are id for some items. I like to find local max, ie.. I can select years from 1990..1999 and want to find out, which are the 10 most popular items in that window for given year. I like to have the results in strip fashion for first k items. So output should look like 'year'X 'item' where each entry in table tells me if item is popular in that year or not. Further sorting to represent minimum gaps at the top would be nice too. For example: Years( 1995..1999). The last column represents the counts in given year.
ItemID  1995    1996    1997    1998    1999
20      =       =       =       =       =               5
5               =       =       =       =               4
6       =               =       =       =               4
7       =               =       =       =               4
12      =       =       =               =               4
14      =       =       =       =                       4
4       =       =               =                       3
9       =       =                       =               3
10      =               =       =                       3
16              =       =               =               3
1               =       =                               2
2       =               =                               2
3       =                               =               2
8               =                       =               2
11                              =       =               2
13      =                       =                       2
17              =       =                               2
19              =                       =               2
15                              =                       1
18                              =                       1
This is not home work, and I have already written some code. I like to know, if there are any modules available..to achieve what I am looking for.

Thanks,

--Artist

In reply to Windows Maximums by artist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-20 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found