code: def transform_to_shard_dict(data, feature_cols, label_cols=None):
      def to_shard_dict(df):
          result = dict()
          result["x"] = [
              df[feature_col].to_numpy() for feature_col in feature_cols
          ]
          if label_cols:
              result["y"] = df[label_cols[0]].to_numpy()
          return result
  
      data = data.transform_shard(to_shard_dict)
      return data
  
file_path: analytics-zoo/pyzoo/zoo/orca/learn/utils.py
imports: from zoo.common.utils import get_file_list
  from zoo.orca.data import SparkXShards
  from zoo.orca.data.utils import get_size
  from zoo.util.utils import convert_row_to_numpy
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: transform_to_shard_dict(data, feature_cols, label_cols) and returns: data, result