docstr: Test that BaseNEncoder produces the correct number of output columns.
  
  Since the value 0 is reserved for encoding unseen values, there need to be enough digits to
  represent up to nvals + 1 distinct encodings, where nvals is the number of distinct input
  values. This is ceil(log(nvals + 1, base)) digits.
  
  This test specifically checks the case where BaseNEncoder is initialized with
  handle_unknown='value' and handle_missing='value' (i.e. the defaults).
docstr_tok: ["Test","that","BaseNEncoder","produces","the","correct","number","of","output","columns",".","Since","the","value","0","is","reserved","for","encoding","unseen","values",",","there","need","to","be","enough","digits","to","represent","up","to","nvals","+","1","distinct","encodings",",","where","nvals","is","the","number","of","distinct","input","values",".","This","is","ceil","(","log","(","nvals","+","1",",","base",")",")","digits",".","This","test","specifically","checks","the","case","where","BaseNEncoder","is","initialized","with","handle_unknown='value","'","and","handle_missing='value","'","(","i.e",".","the","defaults",")","."]
code: def test_num_cols(self):
      """
      Test that BaseNEncoder produces the correct number of output columns.
  
      Since the value 0 is reserved for encoding unseen values, there need to be enough digits to
      represent up to nvals + 1 distinct encodings, where nvals is the number of distinct input
      values. This is ceil(log(nvals + 1, base)) digits.
  
      This test specifically checks the case where BaseNEncoder is initialized with
      handle_unknown='value' and handle_missing='value' (i.e. the defaults).
      """
  
      def num_cols(nvals, base):
          """Returns the number of columns output for a given number of distinct input values"""
          vals = [str(i) for i in range(nvals)]
          df = pd.DataFrame({"vals": vals})
          encoder = encoders.BaseNEncoder(base=base)
          encoder.fit(df)
          return len(list(encoder.transform(df)))
  
      self.assertEqual(num_cols(1, 2), 1)
      self.assertEqual(num_cols(2, 2), 2)
      self.assertEqual(num_cols(3, 2), 2)
      self.assertEqual(num_cols(4, 2), 3)
      self.assertEqual(num_cols(7, 2), 3)
      self.assertEqual(num_cols(8, 2), 4)
      self.assertEqual(num_cols(62, 2), 6)
      self.assertEqual(num_cols(63, 2), 6)
      self.assertEqual(num_cols(64, 2), 7)
      self.assertEqual(num_cols(65, 2), 7)
  
      # nvals = 0 returns the original dataframe unchanged, so it still has 1 column even though
      # logically there should be zero.
      self.assertEqual(num_cols(0, 2), 1)
  
      self.assertEqual(num_cols(55, 7), 3)
  
imports: import pandas
  from unittest import TestCase
  import numpy
  import category_encoders
label_desc: Use image node_id 14 for calling the TestBaseNEncoder obj's underlying member method code with example usage: obj.test_num_cols() and returns: len