class_docstr: Encodes missing values for both numerical and categorical features.
  
  Several strategies are possible in each case.
  
  Parameters
  ----------
  numerical_strategy : str or float or int. default = "mean"
      The strategy to encode NA for numerical features.
      Available strategies = "mean", "median",
      "most_frequent" or a float/int value
  
  categorical_strategy : str, default = '<NULL>'
      The strategy to encode NA for categorical features.
      Available strategies = a string or "most_frequent"
docstr: Fits NA Encoder.
  
  Parameters
  ----------
  df_train : pandas dataframe of shape = (n_train, n_features)
      The train dataset with numerical and categorical features.
  
  y_train : pandas series of shape = (n_train, ), default = None
      The target for classification or regression tasks.
  
  Returns
  -------
  object
      self
code: def fit(self, df_train, y_train=None):
      """Fits NA Encoder.
  
      Parameters
      ----------
      df_train : pandas dataframe of shape = (n_train, n_features)
          The train dataset with numerical and categorical features.
  
      y_train : pandas series of shape = (n_train, ), default = None
          The target for classification or regression tasks.
  
      Returns
      -------
      object
          self
  
      """
      self.__Lcat = df_train.dtypes[df_train.dtypes == "object"].index
      self.__Lnum = df_train.dtypes[df_train.dtypes != "object"].index
  
      # Dealing with numerical features
  
      if self.numerical_strategy in ["mean", "median", "most_frequent"]:
          self.__imp = SimpleImputer(strategy=self.numerical_strategy)
  
          if len(self.__Lnum) != 0:
              self.__imp.fit(df_train[self.__Lnum])
          else:
              pass
  
      elif (type(self.numerical_strategy) == int) | (
          type(self.numerical_strategy) == float
      ):
          pass
  
      else:
          raise ValueError(
              "Numerical strategy for NA encoding is not valid"
          )
  
      # Dealing with categorical features
  
      if type(self.categorical_strategy) == str:
          if self.categorical_strategy == "most_frequent":
              na_count = df_train[self.__Lcat].isnull().sum()
  
              for col in na_count[na_count > 0].index:
                  try:
                      self.__mode[col] = df_train[col].mode()[0]
                  except:
                      self.__mode[col] = "<NULL>"
  
          else:
              pass
  
      else:
          raise ValueError(
              "Categorical strategy for NA encoding is not valid"
          )
  
      self.__fitOK = True
  
      return self
  
file_path: MLBox/mlbox/encoding/na_encoder.py
imports: import pandas
  import warnings
  from sklearn.impute import SimpleImputer
label_desc: Use image node_id 4 for calling the NA_encoder obj's underlying member method code with example usage: obj.fit(df_train, y_train) and returns: self