In order to solve the problem above, I went off reading the Postgres docs and, by sheer chance, stumbled upon the standard deviation – or stddev function. Introducing Postgres Standard Deviation Function Better to just rule the values out when doing the queries, I feel. I’ve thought about manually going through and sanitising the data, but that’s like… manual labour, or something. ![]() So rather than the pay being listed as £20,000 to £25,000 (or whatever), they put in £200000-250000 or whatever, and it really skews everything big time. The issue here is that I’m scraping data from numerous UK job sites, and some absolute chimps decide to enter their pay information in pennies rather than pounds. This data comes from my other site – one I often bang on about on here as a basis for my examples (and frustrations). Here’s the problem, as I faced it (on the front end, at least): My knowledge tops out around GCSE-tier and I’m very grateful that computers are largely clever enough to do all the stuff I need with a little bit of Googling to help me out.īut nevertheless, this one stumped me for a while. OK, so cards on the table time, I am no maths whizz. What you need (probably) is Postgres’s standard deviation function.Īnd fortunately for you (and me), it’s much easier to implement than you might be thinking. ![]() What you’d like to do is eliminate the outlying values from your result set, and keep the ones nearer the “normal” values. Your numbers look alright, but some very high (or very low) values seem to be throwing things out of whack. Here’s the problem we are addressing today: you have a set of numerical data returned by your Postgres query.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |