【发布时间】:2021-07-19 01:27:23
【问题描述】:
我正在绘制气泡图。我的代码如下。
fig = px.scatter(data, x="gdp_per_capita", y="extreme_poverty",
size="total_cases", color="continent",
hover_name="location")
fig.show()
我收到了这个错误
Invalid element(s) received for the 'size' property of scattergl.marker Invalid elements include: [nan, nan, nan, nan, nan, nan, nan, nan, nan, nan] The 'size' property is a number and may be specified as: - An int or float in the interval [0, inf] - A tuple, list, or one-dimensional numpy array of the above
我已经用过了
error_bad_lines=False
在导入数据时。
有没有办法解决这个错误? 谢谢。
【问题讨论】:
-
确保要适应大小的数据是数字的。如果还有更多的 NA,请尝试将其替换为 0。
标签: python plotly-python bubble-chart