class_docstr: The AddMissingIndicator() adds binary variables that indicate if data is
  missing (one indicator per variable). The added variables (missing indicators) are
  named with the original variable name plus ‘_na’.
  
  The AddMissingIndicator() works for both numerical and categorical variables. You
  can pass a list with the variables for which the missing indicators should be
  added. Alternatively, the imputer will select and add missing indicators to all
  variables in the training set.
  
  **Note**
  If `missing_only=True`, the imputer will add missing indicators only to those
  variables that show missing data during `fit()`. These may be a subset of the
  variables you indicated in `variables`.
  
  More details in the :ref:`User Guide <add_missing_indicator>`.
  
  Parameters
  ----------
  missing_only: bool, default=True
      If missing indicators should be added to variables with missing
      data or to all variables.
  
      **True**: indicators will be created only for those variables that showed
      missing data during `fit()`.
  
      **False**: indicators will be created for all variables
  
  variables: list, default=None
      The list of variables to impute. If None, the imputer will find and
      select all variables.
  
  
  Attributes
  ----------
  variables_:
      List of variables for which the missing indicators will be created.
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  fit:
      Find the variables for which the missing indicators will be created
  
  {fit_transform}
  
  transform:
      Add the missing indicators.
  
  Examples
  --------
  
  >>> import pandas as pd
  >>> import numpy as np
  >>> from feature_engine.imputation import AddMissingIndicator
  >>> X = pd.DataFrame(dict(
  >>>        x1 = [np.nan,1,1,0,np.nan],
  >>>        x2 = ["a", np.nan, "b", np.nan, "a"],
  >>>        ))
  >>> ami = AddMissingIndicator()
  >>> ami.fit(X)
  >>> ami.transform(X)
      x1   x2  x1_na  x2_na
  0  NaN    a      1      0
  1  1.0  NaN      0      1
  2  1.0    b      0      0
  3  0.0  NaN      0      1
  4  NaN    a      1      0
class_docstr_tok: ["The","AddMissingIndicator","(",")","adds","binary","variables","that","indicate","if","data","is","missing","(","one","indicator","per","variable",")",".","The","added","variables","(","missing","indicators",")","are","named","with","the","original","variable","name","plus","\u2018","_na","\u2019",".","The","AddMissingIndicator","(",")","works","for","both","numerical","and","categorical","variables",".","You","can","pass","a","list","with","the","variables","for","which","the","missing","indicators","should","be","added",".","Alternatively",",","the","imputer","will","select","and","add","missing","indicators","to","all","variables","in","the","training","set",".","*","*","Note","*","*","If","`","missing_only=True","`",",","the","imputer","will","add","missing","indicators","only","to","those","variables","that","show","missing","data","during","`","fit","(",")","`",".","These","may","be","a","subset","of","the","variables","you","indicated","in","`","variables","`",".","More","details","in","the",":","ref",":","`","User","Guide","<","add_missing_indicator",">","`",".","Parameters","--","--","--","--","--","missing_only",":","bool",",","default=True","If","missing","indicators","should","be","added","to","variables","with","missing","data","or","to","all","variables",".","*","*","True","*","*",":","indicators","will","be","created","only","for","those","variables","that","showed","missing","data","during","`","fit","(",")","`",".","*","*","False","*","*",":","indicators","will","be","created","for","all","variables","variables",":","list",",","default=None","The","list","of","variables","to","impute",".","If","None",",","the","imputer","will","find","and","select","all","variables",".","Attributes","--","--","--","--","--","variables_",":","List","of","variables","for","which","the","missing","indicators","will","be","created",".","{","feature_names_in_","}","{","n_features_in_","}","Methods","--","--","--","-","fit",":","Find","the","variables","for","which","the","missing","indicators","will","be","created","{","fit_transform","}","transform",":","Add","the","missing","indicators",".","Examples","--","--","--","--",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">","from","feature_engine.imputation","import","AddMissingIndicator",">",">",">","X","=","pd.DataFrame","(","dict","(",">",">",">","x1","=","[","np.nan,1,1,0",",","np.nan","]",",",">",">",">","x2","=","[","``","a","''",",","np.nan",",","``","b","''",",","np.nan",",","``","a","''","]",",",">",">",">",")",")",">",">",">","ami","=","AddMissingIndicator","(",")",">",">",">","ami.fit","(","X",")",">",">",">","ami.transform","(","X",")","x1","x2","x1_na","x2_na","0","NaN","a","1","0","1","1.0","NaN","0","1","2","1.0","b","0","0","3","0.0","NaN","0","1","4","NaN","a","1","0"]
docstr: Add the binary missing indicators.
  
  Parameters
  ----------
  
  X : pandas dataframe of shape = [n_samples, n_features]
      The dataframe to be transformed.
  
  Returns
  -------
  
  X_new : pandas dataframe of shape = [n_samples, n_features]
      The dataframe containing the additional binary variables..
docstr_tok: ["Add","the","binary","missing","indicators",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","dataframe","to","be","transformed",".","Returns","--","--","--","-","X_new",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","dataframe","containing","the","additional","binary","variables",".."]
code: def transform(self, X: pd.DataFrame) -> pd.DataFrame:
      """
      Add the binary missing indicators.
  
      Parameters
      ----------
  
      X : pandas dataframe of shape = [n_samples, n_features]
          The dataframe to be transformed.
  
      Returns
      -------
  
      X_new : pandas dataframe of shape = [n_samples, n_features]
          The dataframe containing the additional binary variables..
      """
  
      X = self._transform(X)
  
      indicator_names = [f"{feature}_na" for feature in self.variables_]
      X[indicator_names] = X[self.variables_].isna().astype(int)
  
      return X
  
file_path: feature_engine/feature_engine/imputation/missing_indicator.py
imports: from typing import List, Optional, Union
  import pandas
  from feature_engine._docstrings.fit_attributes import _feature_names_in_docstring, _n_features_in_docstring
  from feature_engine._docstrings.methods import _fit_transform_docstring
  from feature_engine._docstrings.substitute import Substitution
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine._variable_handling.variable_type_selection import _find_all_variables
  from feature_engine.dataframe_checks import check_X
  from feature_engine.imputation.base_imputer import BaseImputer
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 3 for calling the AddMissingIndicator obj's underlying member method code with example usage: obj.transform(X) and returns: X