DrAxeman has asked for the wisdom of the Perl Monks concerning the following question:
I'm having trouble getting proper averages calculated in my tables. All of the data in my table (a CSV file) is wrapped in quotes. For DBI/SQL to calculate the average on the column, I need to remove the quotes. No biggie, except that some data is in scientific notation. When I do my averages, I'm getting outrageous numbers.
Starting data
After I strip the "'s and -'s I've got
The true value of these numbers is
How can I get these properly calculated, or should I just grep for these types of numbers and change the value to 0 since they are so small?
Also, if I were to modify the value to 0, what is the regex that would say "if there is an e in the word, change the whole word to something else"?
Starting data
"5.3271433710011766e-006","5.3271433710011766e-006"
After I strip the "'s and -'s I've got
5.3271433710011766e006,5.3271433710011766e006
The true value of these numbers is
0.00000532714337100118,0.00000532714337100118
How can I get these properly calculated, or should I just grep for these types of numbers and change the value to 0 since they are so small?
Also, if I were to modify the value to 0, what is the regex that would say "if there is an e in the word, change the whole word to something else"?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: SQL Calculations issue
by AReed (Pilgrim) on Aug 10, 2005 at 21:03 UTC | |
by DrAxeman (Scribe) on Aug 10, 2005 at 21:12 UTC | |
Re: SQL Calculations issue
by sgifford (Prior) on Aug 10, 2005 at 21:05 UTC |
Back to
Seekers of Perl Wisdom