{"id":23550,"library":"distogram","title":"distogram","description":"A library to compute histograms on distributed environments, on streaming data. Current version: 3.0.3. Released occasionally, with breaking changes from v2 to v3 (API redesign).","status":"active","version":"3.0.3","language":"python","source_language":"en","source_url":"https://github.com/bitly/distogram","tags":["histogram","streaming","distributed","approximate"],"install":[{"cmd":"pip install distogram","lang":"bash","label":"default"}],"dependencies":[],"imports":[{"note":"In distogram v3, the class is named Distogram (capital D). v2 used a lowercase distogram function.","wrong":"from distogram import distogram","symbol":"Distogram","correct":"from distogram import Distogram"},{"note":"The module-level insert function is now importable directly.","wrong":"distogram.insert(dist, value)","symbol":"insert","correct":"from distogram import insert"},{"note":"The histogram function is now separate; in v2 it was method on distogram object.","wrong":"distogram.histogram(dist, bins=10)","symbol":"histogram","correct":"from distogram import histogram"}],"quickstart":{"code":"from distogram import Distogram, insert, histogram\n\ndist = Distogram()\nfor v in [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]:\n    insert(dist, v)\nbins = histogram(dist, bins=3)\nprint(bins)","lang":"python","description":"Create a Distogram, insert data points, then retrieve histogram bins."},"warnings":[{"fix":"Replace distogram() with Distogram(), and use module-level functions: from distogram import Distogram, insert, histogram.","message":"distogram v3 changes the API from a function-based interface to a class-based one. The old distogram() function is replaced by the Distogram class. Functions like insert, histogram, merge are now module-level functions taking a Distogram object as first argument.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Change Distogram(bin_count=50) to Distogram(max_bins=50).","message":"distogram v3 removes the bin_count parameter from Distogram constructor. Use max_bins instead.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use from distogram import Distogram (capital D).","message":"The old distogram module function (lowercase) is removed in v3. Trying to import it will raise ImportError.","severity":"deprecated","affected_versions":"3.0.0"},{"fix":"Use for approximate histograms only; for exact quantiles use other tools.","message":"distogram does not preserve precise quantiles; it's an approximation. Do not rely on exact percentile values.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from distogram import Distogram and then Distogram().","cause":"Trying to use the old v2 API (distogram.distogram) on v3.","error":"AttributeError: module 'distogram' has no attribute 'distogram'"},{"fix":"Use Distogram(max_bins=50).","cause":"Calling Distogram(bin_count=50) which is v2 syntax. v3 uses max_bins.","error":"TypeError: distogram() takes 1 positional argument but 2 were given"},{"fix":"Upgrade to distogram>=3.0.0 with pip install --upgrade distogram.","cause":"Installed distogram v2.x which does not have the class. Or typo.","error":"ImportError: cannot import name 'Distogram' from 'distogram'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}