MCPcopy
hub / github.com/pandas-dev/pandas / _calculate_bins

Method _calculate_bins

pandas/plotting/_matplotlib/hist.py:95–103  ·  view source on GitHub ↗

Calculate bins given data

(self, data: Series | DataFrame, bins)

Source from the content-addressed store, hash-verified

93 return bins
94
95 def _calculate_bins(self, data: Series | DataFrame, bins) -> np.ndarray:
96 """Calculate bins given data"""
97 nd_values = data.infer_objects()._get_numeric_data()
98 values = nd_values.values
99 if nd_values.ndim == 2:
100 values = values.reshape(-1)
101 values = values[~isna(values)]
102
103 return np.histogram_bin_edges(values, bins=bins, range=self._bin_range)
104
105 # error: Signature of "_plot" incompatible with supertype "LinePlot"
106 @classmethod

Callers 1

_adjust_binsMethod · 0.95

Calls 4

isnaFunction · 0.90
_get_numeric_dataMethod · 0.80
infer_objectsMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected