code: def path_summary(series: pd.Series) -> dict:
      """
  
      Args:
          series: series to summarize
  
      Returns:
  
      """
  
      # TODO: optimize using value counts
      summary = {
          "common_prefix": os.path.commonprefix(series.values.tolist())
          or "No common prefix",
          "stem_counts": series.map(
              lambda x: os.path.splitext(x)[0]
          ).value_counts(),
          "suffix_counts": series.map(
              lambda x: os.path.splitext(x)[1]
          ).value_counts(),
          "name_counts": series.map(
              lambda x: os.path.basename(x)
          ).value_counts(),
          "parent_counts": series.map(
              lambda x: os.path.dirname(x)
          ).value_counts(),
          "anchor_counts": series.map(
              lambda x: os.path.splitdrive(x)[0]
          ).value_counts(),
      }
  
      summary["n_stem_unique"] = len(summary["stem_counts"])
      summary["n_suffix_unique"] = len(summary["suffix_counts"])
      summary["n_name_unique"] = len(summary["name_counts"])
      summary["n_parent_unique"] = len(summary["parent_counts"])
      summary["n_anchor_unique"] = len(summary["anchor_counts"])
  
      return summary
  
imports: import os
  from typing import Tuple
  import pandas
  from ydata_profiling.config import Settings
  from ydata_profiling.model.summary_algorithms import describe_path_1d
label_desc: Use image node_id 1 for calling a global function with example usage: path_summary(series) and returns: summary