class_docstr: Test ClassBalance visualizer
class_docstr_tok: ["Test","ClassBalance","visualizer"]
docstr: Test pandas data frame with string target in compare mode
docstr_tok: ["Test","pandas","data","frame","with","string","target","in","compare","mode"]
code: def test_pandas_occupancy_compare(self):
      """
      Test pandas data frame with string target in compare mode
      """
      data = load_occupancy(return_dataset=True)
      X, y = data.to_pandas()
  
      _, _, y_train, y_test = tts(
          X, y, test_size=0.4, random_state=2242
      )
  
      # Create and fit the visualizer
      oz = ClassBalance()
      assert oz.fit(y_train, y_test) is oz
  
      # oz.finalize()
      self.assert_images_similar(oz, tol=0.5)
  
imports: import pytest
  from yellowbrick.target.class_balance import *
  from yellowbrick.datasets import load_occupancy
  from yellowbrick.exceptions import YellowbrickValueError
  from tests.fixtures import Dataset, Split
  from tests.base import VisualTestCase
  from sklearn.datasets import make_classification
  from sklearn.model_selection import train_test_split
label_desc: Use image node_id 10 for calling the TestClassBalance obj's underlying member method code with example usage: obj.test_pandas_occupancy_compare() without return types