成功解决TypeError: ufunc 'sqrt' not supported for the input types, and the inputs could not be safely co
目录
解决问题
解决思路
解决方法
解决问题
TypeError: ufunc 'sqrt' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
解决思路
类型错误:ufunc 'sqrt'不支持输入类型,并且不能根据类型转换规则“safe”安全地强制输入任何受支持的类型。
解决方法
根据scatter函数用法,可知,绘图属性,需要在前边加上标志符号!
def scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None,
vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None,
hold=None, data=None, **kwargs):
ax = gca()
# Deprecated: allow callers to override the hold state
# by passing hold=True|False
washold = ax._hold
if hold is not None:
ax._hold = hold
from matplotlib.cbook import mplDeprecation
warnings.warn("The 'hold' keyword argument is deprecated since 2.0.",
mplDeprecation)
try:
ret = ax.scatter(x, y, s=s, c=c, marker=marker, cmap=cmap, norm=norm,
vmin=vmin, vmax=vmax, alpha=alpha,
linewidths=linewidths, verts=verts,
edgecolors=edgecolors, data=data, **kwargs)
finally:
ax._hold = washold
sci(ret)
return ret
将
plot.scatter(x,dataRow_i.tolist(), 'r')
改为即可!
plot.scatter(x,dataRow_i.tolist(), c='r')
哈哈,大功告成!