parameters: (
          self, fill_value: Any = None, method: Any = None, dtype: Dtype = None
      )
return_statement: return result
docstring: Fill null values with *fill_value*
docstring_summary: Fill null values with *fill_value*
docstring_tokens: Fill null values with * fill_value *
function: def fillna(
          self, fill_value: Any = None, method: Any = None, dtype: Dtype = None
      ) -> CategoricalColumn:
          """
          Fill null values with *fill_value*
          """
          if not self.nullable:
              return self
  
          if fill_value is not None:
              fill_is_scalar = np.isscalar(fill_value)
  
              if fill_is_scalar:
                  if fill_value == _DEFAULT_CATEGORICAL_VALUE:
                      fill_value = self.codes.dtype.type(fill_value)
                  else:
                      try:
                          fill_value = self._encode(fill_value)
                          fill_value = self.codes.dtype.type(fill_value)
                      except (ValueError) as err:
                          err_msg = "fill value must be in categories"
                          raise ValueError(err_msg) from err
              else:
                  fill_value = column.as_column(fill_value, nan_as_null=False)
                  if isinstance(fill_value, CategoricalColumn):
                      if self.dtype != fill_value.dtype:
                          raise ValueError(
                              "Cannot set a Categorical with another, "
                              "without identical categories"
                          )
                  # TODO: only required if fill_value has a subset of the
                  # categories:
                  fill_value = fill_value._set_categories(
                      self.categories, is_unique=True,
                  )
                  fill_value = column.as_column(fill_value.codes).astype(
                      self.codes.dtype
                  )
  
          result = super().fillna(value=fill_value, method=method)
  
          result = column.build_categorical_column(
              categories=self.dtype.categories._values,
              codes=column.build_column(result.base_data, dtype=result.dtype),
              offset=result.offset,
              size=result.size,
              mask=result.base_mask,
              ordered=self.dtype.ordered,
          )
  
          return result
function_tokens: def fillna ( self , fill_value : Any = None , method : Any = None , dtype : Dtype = None ) -> CategoricalColumn : if not self . nullable : return self if fill_value is not None : fill_is_scalar = np . isscalar ( fill_value ) if fill_is_scalar : if fill_value == _DEFAULT_CATEGORICAL_VALUE : fill_value = self . codes . dtype . type ( fill_value ) else : try : fill_value = self . _encode ( fill_value ) fill_value = self . codes . dtype . type ( fill_value ) except ( ValueError ) as err : err_msg = "fill value must be in categories" raise ValueError ( err_msg ) from err else : fill_value = column . as_column ( fill_value , nan_as_null = False ) if isinstance ( fill_value , CategoricalColumn ) : if self . dtype != fill_value . dtype : raise ValueError ( "Cannot set a Categorical with another, " "without identical categories" ) # TODO: only required if fill_value has a subset of the # categories: fill_value = fill_value . _set_categories ( self . categories , is_unique = True , ) fill_value = column . as_column ( fill_value . codes ) . astype ( self . codes . dtype ) result = super ( ) . fillna ( value = fill_value , method = method ) result = column . build_categorical_column ( categories = self . dtype . categories . _values , codes = column . build_column ( result . base_data , dtype = result . dtype ) , offset = result . offset , size = result . size , mask = result . base_mask , ordered = self . dtype . ordered , ) return result