code: def _integer_counts_to_histogram(num_count_pairs):
      """Turn paired numbers and their counts into data for a histogram.
  
      This centers the bars on the exact integer for clarity. For example, the bar
      for 3 is centered on 3 instead of being between 3 and 4 as in numpy's default
      histogram.
  
      Args:
        num_count_pairs: list of [num, count] pairs
  
      Returns:
        a pandas dataframe with num, count (bin count), s (bin start), e (bin end)
      """
      histogram_data = pd.DataFrame(
          num_count_pairs, columns=["num", "c"]
      )
      # For a proper histogram, use s and e to force each bar to cover
      # exactly one integer position:
      histogram_data["s"] = histogram_data["num"] - 0.5
      histogram_data["e"] = histogram_data["num"] + 0.5
      histogram_data = histogram_data.drop(columns=["num"])
      return histogram_data
  
imports: import io
  import json
  import os
  import altair
  import numpy
  import pandas
  import tensorflow
label_desc: Use image node_id 9 for calling a global function with example usage: _integer_counts_to_histogram(num_count_pairs) and returns: histogram_data