code: def _calc_col_means(mat, densities):
      means = []
      for j in range(mat.shape[1]):
          try:
              means.append(
                  np.average(mat[:, j], weights=densities[:, j])
              )
          except ZeroDivisionError:  # pragma: no cover
              means.append(0)
      return means
  
imports: import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: _calc_col_means(mat, densities) and returns: means