rupesh has asked for the wisdom of the Perl Monks concerning the following question:
Greetings! I seek the help of fellow monks once again. This is with regard to a friend of mine, who gave me a csv containing a database dump.
Below is a sample of the dump.
What is needed is a summary of the report on a monthly basis. This would help in analyzing import-sales ratio for every month. (There is a similar dump for sales. That is a simpler one which does not include the 'region' field.) Output monthly report should look like:Date Product Quantity Imported_From 1/2/04 Shirts 32 Australia 1/9/04 Shoes 234 Asia 2/12/04 Caps 109 UK 4/4/04 Shoes 6 Asia 4/4/04 Shirts 12 Australia 5/6/04 Shirts 398 Australia ..... ...... There are only 3 regions. One or more products can be imported from one or many regions on a sin +gle date. No single column is unique. There are many products, at the last count, it was 34.
I've worked on this for more than a couple of hours now using hashes and makeing '$date_$product' as key and quantity as its value. Using more hashes to seperate the regions. I've also tried to write to temp files and re-creating them for each month.Jan Product Asia Australia UK Total_Imported Shirts 178 12 744 934 Shoes ... ... (products whose total is zero can be omitted) Feb Product Asia Australia UK Total_Imported ....
Is there a simple way to get the whole thing done in a single loop?
I'd appreciate any comments/thoughts from you folks.
Many thanks!
Rupesh.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (Complex)Data Manipulation
by NetWallah (Canon) on Feb 28, 2005 at 06:27 UTC | |
by poqui (Deacon) on Feb 28, 2005 at 18:53 UTC | |
by rupesh (Hermit) on Feb 28, 2005 at 10:21 UTC | |
Re: (Complex)Data Manipulation
by saintmike (Vicar) on Feb 28, 2005 at 06:56 UTC | |
Re: (Complex)Data Manipulation
by TedPride (Priest) on Feb 28, 2005 at 07:52 UTC | |
Re: (Complex)Data Manipulation
by holli (Abbot) on Feb 28, 2005 at 10:26 UTC |
Back to
Seekers of Perl Wisdom