Obtive erro ao tentar executar o seguinte código: quartos = pd.cut(dados.Quartos, classes, labels = labels)
aparece o seguinte erro
ValueError Traceback (most recent call last)
Input In [19], in <cell line: 1>()
----> 1 quartos = pd.cut(dados.Quartos, classes, labels = labels)
File ~\anaconda3\envs\alura_pandas\lib\site-packages\pandas\core\reshape\tile.py:292, in cut(x, bins, right, labels, retbins, precision, include_lowest, duplicates, ordered)
289 if (np.diff(bins.astype("float64")) < 0).any():
290 raise ValueError("bins must increase monotonically.")
--> 292 fac, bins = _bins_to_cuts(
293 x,
294 bins,
295 right=right,
296 labels=labels,
297 precision=precision,
298 include_lowest=include_lowest,
299 dtype=dtype,
300 duplicates=duplicates,
301 ordered=ordered,
302 )
304 return _postprocess_for_cut(fac, bins, retbins, dtype, original)
File ~\anaconda3\envs\alura_pandas\lib\site-packages\pandas\core\reshape\tile.py:453, in _bins_to_cuts(x, bins, right, labels, precision, include_lowest, dtype, duplicates, ordered)
451 else:
452 if len(labels) != len(bins) - 1:
--> 453 raise ValueError(
454 "Bin labels must be one fewer than the number of bin edges"
455 )
456 if not is_categorical_dtype(labels):
457 labels = Categorical(
458 labels,
459 categories=labels if len(set(labels)) == len(labels) else None,
460 ordered=ordered,
461 )
ValueError: Bin labels must be one fewer than the number of bin edges