class_docstr: The EqualWidthDiscretiser() divides continuous numerical variables into
  intervals of the same width, that is, equidistant intervals. Note that the
  proportion of observations per interval may vary.
  
  The size of the interval is calculated as:
  
  .. math::
  
      ( max(X) - min(X) ) / bins
  
  where bins, which is the number of intervals, is determined by the user.
  
  The EqualWidthDiscretiser() works only with numerical variables.
  A list of variables can be passed as argument. Alternatively, the discretiser
  will automatically select all numerical variables.
  
  The EqualWidthDiscretiser() first finds the boundaries for the intervals for
  each variable. Then, it transforms the variables, that is, sorts the values into
  the intervals.
  
  More details in the :ref:`User Guide <equal_width_discretiser>`.
  
  Parameters
  ----------
  {variables}
  
  bins: int, default=10
      Desired number of equal width intervals / bins.
  
  {return_object}
  
  {return_boundaries}
  
  Attributes
  ----------
  {binner_dict_}
  
  {variables_}
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  {fit}
  
  {fit_transform}
  
  {transform}
  
  See Also
  --------
  pandas.cut
  sklearn.preprocessing.KBinsDiscretizer
  
  References
  ----------
  .. [1] Kotsiantis and Pintelas, "Data preprocessing for supervised leaning,"
      International Journal of Computer Science,  vol. 1, pp. 111 117, 2006.
  
  .. [2] Dong. "Beating Kaggle the easy way". Master Thesis.
      https://www.ke.tu-darmstadt.de/lehre/arbeiten/studien/2015/Dong_Ying.pdf
  
  Examples
  --------
  
  >>> import pandas as pd
  >>> import numpy as np
  >>> from feature_engine.discretisation import EqualWidthDiscretiser
  >>> np.random.seed(42)
  >>> X = pd.DataFrame(dict(x = np.random.randint(1,100, 100)))
  >>> ewd = EqualWidthDiscretiser()
  >>> ewd.fit(X)
  >>> ewd.transform(X)["x"].value_counts()
  9    15
  6    15
  0    13
  5    11
  8     9
  7     8
  2     8
  1     7
  3     7
  4     7
  Name: x, dtype: int64
docstr: Learn the boundaries of the equal width intervals / bins for each
  variable.
  
  Parameters
  ----------
  X: pandas dataframe of shape = [n_samples, n_features]
      The training dataset. Can be the entire dataframe, not just the variables
      to be transformed.
  y: None
      y is not needed in this encoder. You can pass y or None.
code: def fit(self, X: pd.DataFrame, y: Optional[pd.Series] = None):
      """
      Learn the boundaries of the equal width intervals / bins for each
      variable.
  
      Parameters
      ----------
      X: pandas dataframe of shape = [n_samples, n_features]
          The training dataset. Can be the entire dataframe, not just the variables
          to be transformed.
      y: None
          y is not needed in this encoder. You can pass y or None.
      """
  
      # check input dataframe
      X = super().fit(X)
  
      # fit
      self.binner_dict_ = {}
  
      for var in self.variables_:
          tmp, bins = pd.cut(
              x=X[var], bins=self.bins, retbins=True, duplicates="drop"
          )
  
          # Prepend/Append infinities
          bins = list(bins)
          bins[0] = float("-inf")
          bins[len(bins) - 1] = float("inf")
          self.binner_dict_[var] = bins
  
      return self
  
file_path: feature_engine/feature_engine/discretisation/equal_width.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, _variables_attribute_docstring
  from feature_engine._docstrings.init_parameters import _variables_numerical_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.discretisation.base_discretiser import BaseDiscretiser
label_desc: Use image node_id 2 for calling the EqualWidthDiscretiser obj's underlying member method code with example usage: obj.fit(X, y) and returns: self