Skip to content

Instantly share code, notes, and snippets.

@pavlin-policar
Created May 15, 2020 12:15
Show Gist options
  • Save pavlin-policar/c3066866ebcceff98d7c2859811449b5 to your computer and use it in GitHub Desktop.
Save pavlin-policar/c3066866ebcceff98d7c2859811449b5 to your computer and use it in GitHub Desktop.
def _get_required_decimals(x: np.ndarray) -> int:
"""Determine the number of decimals needed to nicely show the data."""
req_decimals = np.floor(np.log10(x))
dec = np.percentile(req_decimals, [5])
return abs(int(dec))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment