shakedzy / dython

A set of data tools in Python
http://shakedzy.xyz/dython/
MIT License
496 stars 102 forks source link

TypeError Traceback (most recent call last) #148

Closed AprilET closed 1 year ago

AprilET commented 1 year ago

I installed using the conda install -c conda-forge dython so I seem to be on 0.6.7.post2 and I cant seem to update from this package. Python version is 3.9.16.

i was trying the mushroom data after finding this on Kaggle and just get the following:


TypeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 associations(Shroom, nom_nom_assoc="theil", figsize=(15, 15))

File ~\anaconda3\lib\site-packages\dython\nominal.py:806, in associations(dataset, nominal_columns, numerical_columns, mark_columns, nom_nom_assoc, num_num_assoc, bias_correction, nan_strategy, nan_replace_value, ax, figsize, annot, fmt, cmap, sv_color, cbar, vmax, vmin, plot, compute_only, clustering, title, filename) 804 mask = np.vectorize(lambda x: not bool(x))(inf_nan_mask) + np.vectorize(lambda x: not bool(x))(sv_mask) 805 vmin = vmin or (-1.0 if len(columns) - len(nominal_columns) >= 2 else 0.0) --> 806 ax = sns.heatmap(corr, 807 cmap=cmap, 808 annot=annot, 809 fmt=fmt, 810 center=0, 811 vmax=vmax, 812 vmin=vmin, 813 square=True, 814 mask=mask, 815 ax=ax, 816 cbar=cbar) 817 plt.title(title) 818 if filename:

File ~\anaconda3\lib\site-packages\seaborn\matrix.py:459, in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs) 457 if square: 458 ax.set_aspect("equal") --> 459 plotter.plot(ax, cbar_ax, kwargs) 460 return ax

File ~\anaconda3\lib\site-packages\seaborn\matrix.py:306, in _HeatMapper.plot(self, ax, cax, kws) 303 kws.setdefault("vmax", self.vmax) 305 # Draw the heatmap --> 306 mesh = ax.pcolormesh(self.plot_data, cmap=self.cmap, **kws) 308 # Set the axis limits 309 ax.set(xlim=(0, self.data.shape[1]), ylim=(0, self.data.shape[0]))

File ~\anaconda3\lib\site-packages\matplotlib__init__.py:1442, in _preprocess_data..inner(ax, data, *args, kwargs) 1439 @functools.wraps(func) 1440 def inner(ax, *args, data=None, *kwargs): 1441 if data is None: -> 1442 return func(ax, map(sanitize_sequence, args), kwargs) 1444 bound = new_sig.bind(ax, *args, **kwargs) 1445 auto_label = (bound.arguments.get(label_namer) 1446 or bound.kwargs.get(label_namer))

File ~\anaconda3\lib\site-packages\matplotlib\axes_axes.py:6229, in Axes.pcolormesh(self, alpha, norm, cmap, vmin, vmax, shading, antialiased, *args, kwargs) 6225 C = C.ravel() 6227 kwargs.setdefault('snap', mpl.rcParams['pcolormesh.snap']) -> 6229 collection = mcoll.QuadMesh( 6230 coords, antialiased=antialiased, shading=shading, 6231 array=C, cmap=cmap, norm=norm, alpha=alpha, kwargs) 6232 collection._scale_norm(norm, vmin, vmax) 6234 coords = coords.reshape(-1, 2) # flatten the grid structure; keep x, y

File ~\anaconda3\lib\site-packages\matplotlib\collections.py:1939, in QuadMesh.init(self, coordinates, antialiased, shading, kwargs) 1936 self._bbox.update_from_data_xy(self._coordinates.reshape(-1, 2)) 1937 # super init delayed after own init because array kwarg requires 1938 # self._coordinates and self._shading -> 1939 super().init(kwargs) 1940 self.set_mouseover(False)

File ~\anaconda3\lib\site-packages\matplotlib_api\deprecation.py:454, in make_keyword_only..wrapper(*args, *kwargs) 448 if len(args) > name_idx: 449 warn_deprecated( 450 since, message="Passing the %(name)s %(obj_type)s " 451 "positionally is deprecated since Matplotlib %(since)s; the " 452 "parameter will become keyword-only %(removal)s.", 453 name=name, obj_type=f"parameter of {func.name}()") --> 454 return func(args, **kwargs)

File ~\anaconda3\lib\site-packages\matplotlib\collections.py:201, in Collection.init(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, offset_transform, norm, cmap, pickradius, hatch, urls, zorder, **kwargs) 198 self._offset_transform = offset_transform 200 self._path_effects = None --> 201 self._internal_update(kwargs) 202 self._paths = None

File ~\anaconda3\lib\site-packages\matplotlib\artist.py:1223, in Artist._internal_update(self, kwargs) 1216 def _internal_update(self, kwargs): 1217 """ 1218 Update artist properties without prenormalizing them, but generating 1219 errors as if calling set. 1220 1221 The lack of prenormalization is to maintain backcompatibility. 1222 """ -> 1223 return self._update_props( 1224 kwargs, "{cls.name}.set() got an unexpected keyword argument " 1225 "{prop_name!r}")

File ~\anaconda3\lib\site-packages\matplotlib\artist.py:1199, in Artist._update_props(self, props, errfmt) 1196 if not callable(func): 1197 raise AttributeError( 1198 errfmt.format(cls=type(self), prop_name=k)) -> 1199 ret.append(func(v)) 1200 if ret: 1201 self.pchanged()

File ~\anaconda3\lib\site-packages\matplotlib\collections.py:1986, in QuadMesh.set_array(self, A) 1981 if shape not in ok_shapes: 1982 raise ValueError( 1983 f"For X ({width}) and Y ({height}) with {self._shading} " 1984 f"shading, A should have shape " 1985 f"{' or '.join(map(str, ok_shapes))}, not {A.shape}") -> 1986 return super().set_array(A)

File ~\anaconda3\lib\site-packages\matplotlib\cm.py:515, in ScalarMappable.set_array(self, A) 513 A = cbook.safe_masked_invalid(A, copy=True) 514 if not np.can_cast(A.dtype, float, "same_kind"): --> 515 raise TypeError(f"Image data of dtype {A.dtype} cannot be " 516 "converted to float") 518 self._A = A

TypeError: Image data of dtype object cannot be converted to float

AprilET commented 1 year ago

Ok I looked through some of the previous issues and saw the one about Pandas needing to be less than 1.5. Mine was 1.5.3 so I changed it back to 1.4.4 and it is now working.