class_docstr: Base class for generator of stats proto from generic data.
class_docstr_tok: ["Base","class","for","generator","of","stats","proto","from","generic","data","."]
docstr: Converts an ndarray to the Entry format.
docstr_tok: ["Converts","an","ndarray","to","the","Entry","format","."]
code: def NdarrayToEntry(self, x):
      """Converts an ndarray to the Entry format."""
      row_counts = []
      for row in x:
          try:
              rc = np.count_nonzero(~np.isnan(row))
              if rc != 0:
                  row_counts.append(rc)
          except TypeError:
              try:
                  row_counts.append(row.size)
              except AttributeError:
                  row_counts.append(1)
  
      data_type = self.DtypeToType(x.dtype)
      converter = self.DtypeToNumberConverter(x.dtype)
      flattened = x.ravel()
      orig_size = len(flattened)
  
      # Remove all None and nan values and count how many were removed.
      flattened = flattened[flattened != np.array(None)]
      if converter:
          flattened = converter(flattened)
      if data_type == self.fs_proto.STRING:
          flattened_temp = []
          for x in flattened:
              try:
                  if str(x) != "nan":
                      flattened_temp.append(x)
              except UnicodeEncodeError:
                  if x.encode("utf-8") != "nan":
                      flattened_temp.append(x)
          flattened = flattened_temp
      else:
          flattened = flattened[~np.isnan(flattened)].tolist()
      missing = orig_size - len(flattened)
      return {
          "vals": flattened,
          "counts": row_counts,
          "missing": missing,
          "type": data_type,
      }
  
file_path: facets/facets_overview/python/base_generic_feature_statistics_generator.py
imports: import numpy
  import pandas
  import sys
  import warnings
label_desc: Use image node_id 5 for calling the BaseGenericFeatureStatisticsGenerator obj's underlying member method code with example usage: obj.NdarrayToEntry(x) and returns: dict