Calculating statistics directly from a CSV file
Posted
by User1
on Stack Overflow
See other posts from Stack Overflow
or by User1
Published on 2010-04-16T19:21:51Z
Indexed on
2010/04/16
19:23 UTC
Read the original article
Hit count: 186
I have a transaction log file in CSV format that I want use to run statistics. The log has the following fields:
date: Time/date stamp salesperson: The username of the person who closed the sale promo: sum total of items in the sale that were promotions. amount: grand total of the sale
I'd like to get the following statistics:
salesperson: The username of the salesperson being analyzed. minAmount: The smallest grand total of this salesperson's transaction. avgAmount: The mean grand total.. maxAmount: The largest grand total.. minPromo: The smallest promo amount by the salesperson. avgPromo: The mean promo amount...
I'm tempted to build a database structure, import this file, write SQL, and pull out the stats. I don't need anything more from this data than these stats. Is there an easier way? I'm hoping some bash script could make this easy.
© Stack Overflow or respective owner