ValueError: Input data must be a pandas object to reorder

введите сюда описание изображения ValueError Traceback (most recent call last) Cell In[49], line 2 1 #построен для спальни ----> 2 sns.countplot(data.bedrooms,order=data['bedrooms'].value_counts().index)

File c:\Users\brazz\AppData\Local\Programs\Python\Python311\Lib\site-packages\seaborn\categorical.py:2943, in countplot(data, x, y, hue, order, hue_order, orient, color, palette, saturation, width, dodge, ax, **kwargs)
   2940 elif x is not None and y is not None:
   2941     raise ValueError("Cannot pass values for both `x` and `y`")
-> 2943 plotter = _CountPlotter(
   2944     x, y, hue, data, order, hue_order,
   2945     estimator, errorbar, n_boot, units, seed,
   2946     orient, color, palette, saturation,
   2947     width, errcolor, errwidth, capsize, dodge
   2948 )
   2950 plotter.value_label = "count"
   2952 if ax is None:

File c:\Users\brazz\AppData\Local\Programs\Python\Python311\Lib\site-packages\seaborn\categorical.py:1530, in _BarPlotter.__init__(self, x, y, hue, data, order, hue_order, estimator, errorbar, n_boot, units, seed, orient, color, palette, saturation, width, errcolor, errwidth, capsize, dodge)
   1525 def __init__(self, x, y, hue, data, order, hue_order,
   1526              estimator, errorbar, n_boot, units, seed,
   1527              orient, color, palette, saturation, width,
   1528              errcolor, errwidth, capsize, dodge):
   1529     """Initialize the plotter."""
-> 1530     self.establish_variables(x, y, hue, data, orient,
   1531                              order, hue_order, units)
   1532     self.establish_colors(color, palette, saturation)
   1533     self.estimate_statistic(estimator, errorbar, n_boot, seed)

File c:\Users\brazz\AppData\Local\Programs\Python\Python311\Lib\site-packages\seaborn\categorical.py:481, in _CategoricalPlotter.establish_variables(self, x, y, hue, data, orient, order, hue_order, units)
    479 if order is not None:
    480     error = "Input data must be a pandas object to reorder"
--> 481     raise ValueError(error)
    483 # The input data is an array
    484 if hasattr(data, "shape"):

ValueError: Input data must be a pandas object to reorder


Ответы (0 шт):