{"id":9944,"library":"millify","title":"Millify","description":"Millify is a lightweight Python library designed to convert large numbers into human-readable, \"millified\" formats, similar to how social media platforms display follower counts (e.g., 1,234,567 becomes 1.23M). It currently stands at version 0.1.1 and has a relatively slow release cadence, with updates focused on minor improvements and bug fixes.","status":"active","version":"0.1.1","language":"en","source_language":"en","source_url":"https://github.com/azaitsev/millify","tags":["numbers","formatting","utility","human-readable","millify","data-display"],"install":[{"cmd":"pip install millify","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.7 or higher.","package":"python","optional":false}],"imports":[{"symbol":"millify","correct":"from millify import millify"}],"quickstart":{"code":"from millify import millify\n\n# Basic usage: 1,234,567 -> 1.23M\nprint(f\"Default: {millify(1234567)}\")\n\n# With specified precision: 987,654,321 -> 988M (3 significant digits)\nprint(f\"Precision=3: {millify(987654321, precision=3)}\")\n\n# With specified decimal places: 5,000,000,000 -> 5.0B\nprint(f\"Decimal places=1: {millify(5000000000, decimal_places=1)}\")\n\n# Custom prefixes for different scales (e.g., 'K' for 10^3, 'M' for 10^6, 'G' for 10^9)\nprint(f\"Custom prefixes: {millify(1024 * 1024 * 5, prefixes=['', 'KB', 'MB', 'GB'], decimal_places=2)}\")\n","lang":"python","description":"Demonstrates the basic usage of the `millify` function to convert numbers, including setting precision, specifying decimal places, and using custom prefixes for different scaling requirements."},"warnings":[{"fix":"Choose either `precision` for significant digits or `decimal_places` for digits after the decimal point based on desired behavior. Do not use both simultaneously unless you intend `decimal_places` to override.","message":"When both `precision` and `decimal_places` are provided to the `millify` function, `decimal_places` will take precedence, overriding the `precision` setting.","severity":"gotcha","affected_versions":"0.1.x"},{"fix":"Pass a list of custom prefixes using the `prefixes` argument (e.g., `prefixes=['', 'KB', 'MB', 'GB']`) to match your specific domain requirements.","message":"The default prefixes (K, M, B, T for thousands, millions, billions, trillions) are based on standard SI units. For contexts requiring different scales or binary prefixes (e.g., KiB, MiB for computing), custom prefixes must be explicitly provided.","severity":"gotcha","affected_versions":"0.1.x"},{"fix":"Set `drop_zeros=False` in the `millify` function call to retain trailing zeros after the decimal point.","message":"By default, `drop_zeros=True`, meaning trailing zeros after the decimal point will be removed (e.g., `1.0M` becomes `1M`). If you need to always show a specific number of decimal places, including trailing zeros, this default behavior might be unexpected.","severity":"gotcha","affected_versions":"0.1.x"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure the value passed to `millify` is an integer or a float.","cause":"The input value passed to the `millify` function was not a number (e.g., a string, list, or None).","error":"TypeError: 'int' object is not subscriptable"},{"fix":"Remove the `decimal_places` argument if you are using `precision`. If you need to keep trailing zeros, set `drop_zeros=False`.","cause":"This is often due to `decimal_places` being set simultaneously (which overrides `precision`), or `drop_zeros=True` (the default) removing trailing zeros.","error":"My number isn't displaying the right number of decimal places even with precision set."}]}