class_docstr: Class for textflint bar chart Report.
  Code from https://github.com/robustness-gym/robustness-gym
class_docstr_tok: ["Class","for","textflint","bar","chart","Report",".","Code","from","https",":","\/\/github.com\/robustness-gym\/robustness-gym"]
docstr: Sort rows in report by category / slice alphabetically, or using
  specified order.
  
  :param category_order: map from category name to sorting rank. If None,
    sort categories alphabetically.
  :param slice_order: map from slice name to sorting rank. If None, sort
    slices alphabetically (within a category).
docstr_tok: ["Sort","rows","in","report","by","category","\/","slice","alphabetically",",","or","using","specified","order",".",":","param","category_order",":","map","from","category","name","to","sorting","rank",".","If","None",",","sort","categories","alphabetically",".",":","param","slice_order",":","map","from","slice","name","to","sorting","rank",".","If","None",",","sort","slices","alphabetically","(","within","a","category",")","."]
code: def sort(self, category_order=None, slice_order=None):
      r"""
      Sort rows in report by category / slice alphabetically, or using
      specified order.
  
      :param category_order: map from category name to sorting rank. If None,
        sort categories alphabetically.
      :param slice_order: map from slice name to sorting rank. If None, sort
        slices alphabetically (within a category).
  
      """
      if category_order is None:
          category_order = {}
  
      if slice_order is None:
          slice_order = {}
  
      for col_name in ["sort-order-category", "sort-order-slice"]:
          if col_name in self.data:
              raise ValueError(f"Column name '{col_name}' is reserved")
  
      self.data["sort-order-category"] = self.data[0].map(
          lambda x: (category_order.get(x, 2**10000), x)
      )
      self.data["sort-order-slice"] = self.data[1].map(
          lambda x: (slice_order.get(x, 2**10000), x)
      )
  
      self.data = self.data.sort_values(
          by=["sort-order-category", "sort-order-slice"]
      ).drop(
          ["sort-order-category", "sort-order-slice"], axis="columns"
      )
  
      self.data.reset_index(inplace=True, drop=True)
  
imports: from __future__ import annotations
  import itertools
  from functools import partial
  from typing import Dict, List
  import dill
  import numpy
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  import plotly.express
  from ..analyzer.analyzer import *
label_desc: Use image node_id 2 for calling the BarChart obj's underlying member method code with example usage: obj.sort(category_order, slice_order) without return types