(histogram: List[Tuple[int, float]],
                     bin_size: Union[int, float])
return "".join(histogram_str)
Print histogram nicely.
Print histogram nicely.
Print histogram nicely .
def _print_histogram(histogram: List[Tuple[int, float]],
                     bin_size: Union[int, float]) -> Text:
  """Print histogram nicely."""
  histogram_str = []
  for k, v in histogram:
    if k == 0:
      histogram_str.append("[0]")
    elif k == 1:
      if isinstance(bin_size, int):
        histogram_str.append("(0, %d)" % bin_size)
      else:
        histogram_str.append("(0, %.2f)" % bin_size)
    else:
      if isinstance(bin_size, int):
        histogram_str.append("[%d, %d)" % (bin_size * k, bin_size * (k + 1)))
      else:
        histogram_str.append("[%.2f, %.2f)" % (bin_size * k, bin_size *
                                               (k + 1)))
    histogram_str.append(": %.4f, " % v)

  return "".join(histogram_str)
def _print_histogram ( histogram : List [ Tuple [ int , float ] ] , bin_size : Union [ int , float ] ) -> Text : histogram_str = [ ] for k , v in histogram : if k == 0 : histogram_str . append ( "[0]" ) elif k == 1 : if isinstance ( bin_size , int ) : histogram_str . append ( "(0, %d)" % bin_size ) else : histogram_str . append ( "(0, %.2f)" % bin_size ) else : if isinstance ( bin_size , int ) : histogram_str . append ( "[%d, %d)" % ( bin_size * k , bin_size * ( k + 1 ) ) ) else : histogram_str . append ( "[%.2f, %.2f)" % ( bin_size * k , bin_size * ( k + 1 ) ) ) histogram_str . append ( ": %.4f, " % v ) return "" . join ( histogram_str )