class_docstr: A flow to generate some statistics about the movie genres.
  
  The flow performs the following steps:
  1) Ingests a CSV into a dataframe.
  2) Fan-out over genre using Metaflow foreach.
  3) Compute quartiles for each genre.
  4) Save a dictionary of genre-specific statistics.
docstr: The start step:
  1) Loads the movie metadata into dataframe.
  2) Finds all the unique genres.
  3) Launches parallel statistics computation for each genre.
docstr_tok: ["The","start","step",":","1",")","Loads","the","movie","metadata","into","dataframe",".","2",")","Finds","all","the","unique","genres",".","3",")","Launches","parallel","statistics","computation","for","each","genre","."]
code: def start(self):
      """
      The start step:
      1) Loads the movie metadata into dataframe.
      2) Finds all the unique genres.
      3) Launches parallel statistics computation for each genre.
  
      """
      import csv
      from io import StringIO
  
      # Load the data set into a dataframe structure.
      self.dataframe = {
          "movie_title": [],
          "title_year": [],
          "genres": [],
          "gross": [],
      }
  
      for row in csv.reader(StringIO(self.movie_data), delimiter=","):
          if row[0] == "movie_title":
              continue
          self.dataframe["movie_title"].append(row[0])
          self.dataframe["title_year"].append(int(row[1]))
          self.dataframe["genres"].append(row[2])
          self.dataframe["gross"].append(int(row[3]))
  
      # The column 'genres' has a list of genres for each movie. Let's get
      # all the unique genres.
      self.genres = {
          genre
          for genres in self.dataframe["genres"]
          for genre in genres.split("|")
      }
      self.genres = list(self.genres)
  
      # We want to compute some statistics for each genre. The 'foreach'
      # keyword argument allows us to compute the statistics for each genre in
      # parallel (i.e. a fan-out).
      self.next(self.compute_statistics, foreach="genres")
  
file_path: metaflow/metaflow/tutorials/02-statistics/stats.py
imports: from metaflow import FlowSpec, step, IncludeFile
label_desc: Use image node_id 1 for calling the MovieStatsFlow obj's underlying member method code with example usage: obj.start() without return types