4 ms·
But they are. Zips here in Denmark are clustered progressively, so that if you have a package going to (say) 8600 and 8704 then it makes some sense to send thos
by tomjen3 5y ago
But they are. Zips here in Denmark are clustered progressively, so that if you have a package going to (say) 8600 and 8704 then it makes some sense to send those orders to the same distribution node, since they will be close together, but to do that you need to treat them as numbers.
My grandparents first phone number was 13. Not because they got in super early and had the 13th phone number in the country, but because that was the 13th number for their exchange. When a bunch of exchanges were put together everybody got another number in front of theirs. Their phone number is much longer today, but it still ends in 13.
I guess you could treat the phone numbers as strings, but I don't know if you can do that with the Danish zip numbers.
- pintxo 5y agoLots of phone numbers start with a zero, converting string to numbers will most likely change the phone number by removing the information of the leading zero. Doing this in js will store it as base 8. Neither will make anyone happy.
- bombcar 5y agoExcel loves replacing phone numbers with 12031041e8 or whatever when importing CSV. So useful.
- dylan604 5y agoThis is one of the most annoying things to me about Excel (of a long list). In pretty much every time MS applications feel they are smarter than me ends in MS application being wrong. It doesn't matter if the data is manually typed or pasted from else where, when Excel tries to auto-guess how to set the formatting of the cell is just horrid. Dates are shite when trying to be in the US and using UK formatted dates.
- hermitdev 5y agoWhat's even worse is if you inadvertently save the CSV with the auto format, the data will be lost, too. Excel is both a wonderful tool and the bane of my existence when dealing with financials.
- silvestrov 5y agoYou should never use clustering/subtraction on Danish zip codes as a source of "how hearby". To quote https://www.postnumre.dk https://www.postnumre.dk 2400 Copenhagen NV (North West) 2412 Santa Claus, Greenland 2450 Copenhagen SV (South West) ... 3790 Hasle (close to Roskilde) 3900 Nuuk (Geenland) 3992 Dog sled patrol "Sirius" 4000 Roskilde
- wombatpm 5y agoUnless it is encoded in its design. For US zip codes the first three digits encode a geographic region. But there is no guarantee that 601 is next to 602
- deleted 5y ago[deleted]
- chiph 5y agoEven in North America, you shouldn't treat ZIP/postal codes as numbers. The US added 4 digits 30-ish years ago (ZIP+4) and they're separated with a dash. You could store them as separate numbers [0] and rely on the presentation code to add the dash. But since Canada has alphanumeric postal codes (Mexico uses numbers), you're better off treating them as a string field. The US used to prefix phone numbers with letters (like MElrose 1-2345) as an aide-mémoire during the transition to 8 digits with area codes. And you'll still see businesses advertising with letters in place of digits (like 800-GOT-JUNK which is a junk removal firm) but they never get entered into phone number fields like that. The best reason to have phone numbers as text though, is the digit groupings [1]. In North America, it's 3-3-4 but other countries group their numbers differently to help people remember them. So allowing users to enter numbers in their format you're making it easy for them. [0] The main reason to do this is if you're in the business of sending out mailings. The US postal service gives discounts if you sort and bundle by ZIP code, and mixed ZIP and ZIP+4 values would make that hard. [1] https://en.wikipedia.org/wiki/Chunking_(psychology) https://en.wikipedia.org/wiki/Chunking_(psychology)
- akersten 5y agoA ZIP code is an identifier made of numerals, it is not a number in the mathematical sense. It does not make sense to multiply, add, subtract, or divide them - even though the numerals are assigned in apparently ascending order. There's nothing preventing a future decree from making one that starts with a Z, or a 0, or putting a dash in the middle of it. It is foolish to store it as an integer type. You can cluster them for distance without storing them as an integer. Just throw them in a graph data type and compute edges having actual integral weights. The ZIPs themselves are not what you want to be doing your math on.