docstr: Calculate bins given data
docstr_tok: ["Calculate","bins","given","data"]
code: def _calculate_bins(self, data: DataFrame) -> np.ndarray:
      """Calculate bins given data"""
      nd_values = data.infer_objects(copy=False)._get_numeric_data()
      values = np.ravel(nd_values)
      values = values[~isna(values)]
  
      hist, bins = np.histogram(
          values, bins=self.bins, range=self.kwds.get("range", None)
      )
      return bins
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Literal
  import numpy
  from pandas._typing import PlottingOrientation
  from pandas.core.dtypes.common import is_integer, is_list_like
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndex
  from pandas.core.dtypes.missing import isna, remove_na_arraylike
  from pandas.io.formats.printing import pprint_thing
  from pandas.plotting._matplotlib.core import LinePlot, MPLPlot
  from pandas.plotting._matplotlib.groupby import create_iter_data_given_by, reformat_hist_y_given_by
  from pandas.plotting._matplotlib.misc import unpack_single_str_list
  from pandas.plotting._matplotlib.tools import create_subplots, flatten_axes, maybe_adjust_figure, set_ticks_props
label_desc: Use image node_id 4 for calling the HistPlot obj's underlying member method code with example usage: obj._calculate_bins(data) and returns: bins