class_docstr: Plot functions for mixed type x & y axes:
  
  Methods:
      - bar
      - bar_stacked
      - lollipop
      - parallel
class_docstr_tok: ["Plot","functions","for","mixed","type","x","&","y","axes",":","Methods",":","-","bar","-","bar_stacked","-","lollipop","-","parallel"]
code: def _sort_categories_by_value(
      source, categorical_columns, categorical_order_ascending
  ):
      # Recursively sort values within each level of the index.
      row_totals = source.sum(axis=1, numeric_only=True)
      row_totals.name = "sum"
      old_index = row_totals.index
      row_totals = row_totals.reset_index()
      row_totals.columns = ["_%s" % col for col in row_totals.columns]
      row_totals.index = old_index
  
      hierarchical_sort_cols = categorical_columns[:]
      for i, _ in enumerate(hierarchical_sort_cols):
          row_totals["level_%s" % i] = row_totals.groupby(
              hierarchical_sort_cols[: i + 1]
          )["_sum"].transform("sum")
      row_totals = row_totals.sort_values(
          by=[
              "level_%s" % i
              for i, _ in enumerate(hierarchical_sort_cols)
          ],
          ascending=categorical_order_ascending,
      )
      return source.reindex(row_totals.index)
  
imports: import bokeh
  import pandas
  import numpy
  from chartify._core.colors import Color, color_palettes
  from chartify._core.axes import NumericalYMixin, NumericalXMixin
  from scipy.stats import gaussian_kde
label_desc: Use image node_id 4 for calling the PlotMixedTypeXY obj's underlying member method code with example usage: obj._sort_categories_by_value(source, categorical_columns, categorical_order_ascending) and returns: source