original_docstring: Adds zone name/id to plant and branch data frames of grid instance.
  
      :param powersimdata.input.grid.Grid grid: grid instance.
      
docstring: Adds zone name/id to plant and branch data frames of grid instance.
docstring_tokens: Adds zone name / id to plant and branch data frames of grid instance .
code: def add_zone_to_grid_data_frames(grid):
      """Adds zone name/id to plant and branch data frames of grid instance.
  
      :param powersimdata.input.grid.Grid grid: grid instance.
      """
      bus2zone = grid.bus.zone_id.to_dict()
  
      def get_zone_id(idx):
          return [bus2zone[i] for i in idx]
  
      def get_zone_name(idx):
          return [grid.id2zone[bus2zone[i]] for i in idx]
  
      extra_col_plant = {
          "zone_id": get_zone_id(grid.plant.bus_id),
          "zone_name": get_zone_name(grid.plant.bus_id),
      }
      add_column_to_data_frame(grid.plant, extra_col_plant)
  
      extra_col_branch = {
          "from_zone_id": get_zone_id(grid.branch.from_bus_id),
          "to_zone_id": get_zone_id(grid.branch.to_bus_id),
          "from_zone_name": get_zone_name(grid.branch.from_bus_id),
          "to_zone_name": get_zone_name(grid.branch.to_bus_id),
      }
      add_column_to_data_frame(grid.branch, extra_col_branch)
code_tokens: def add_zone_to_grid_data_frames ( grid ) : bus2zone = grid . bus . zone_id . to_dict ( ) def get_zone_id ( idx ) : return [ bus2zone [ i ] for i in idx ] def get_zone_name ( idx ) : return [ grid . id2zone [ bus2zone [ i ] ] for i in idx ] extra_col_plant = { "zone_id" : get_zone_id ( grid . plant . bus_id ) , "zone_name" : get_zone_name ( grid . plant . bus_id ) , } add_column_to_data_frame ( grid . plant , extra_col_plant ) extra_col_branch = { "from_zone_id" : get_zone_id ( grid . branch . from_bus_id ) , "to_zone_id" : get_zone_id ( grid . branch . to_bus_id ) , "from_zone_name" : get_zone_name ( grid . branch . from_bus_id ) , "to_zone_name" : get_zone_name ( grid . branch . to_bus_id ) , } add_column_to_data_frame ( grid . branch , extra_col_branch )
short_docstring: Adds zone name/id to plant and branch data frames of grid instance.
short_docstring_tokens: Adds zone name / id to plant and branch data frames of grid instance .
comment: """Adds zone name/id to plant and branch data frames of grid instance.
  
      :param powersimdata.input.grid.Grid grid: grid instance.
      """