x lines of Python: Physical units
Difficulty rating: Intermediate Have you ever wished you could carry units around with your quantities — and have the computer figure out the best units and multipliers to use? pint is a nice, compact library for doing just this, handling all your dimensional analysis needs. It can also detect units from strings. We can define our own units, it knows about multipliers (kilo, mega, etc), and it even works with numpy and pandas. To use…