在合并做的图表时报错了'NoneType' object has no attribute 'append'
但我并没用到append啊?
from pyecharts import Bar,Grid
grid = Grid(height=720, width=1200)
grid.add(geo, grid_bottom="60%", grid_left="60%")
grid.add(bar, grid_bottom="60%", grid_right="60%")
grid.add(geo2, grid_top="60%", grid_left="60%")
grid.add(wc, grid_top="60%", grid_right="60%")
grid.render("景区图汇总.html")
可能是你在调用 add 方法之前,所传入的 geo, bar, geo2, wc 中的某个对象为 None。在 Python 中,如果一个变量的值为 None,那么这个变量就是一个 NoneType 类型的对象。
你可以修改一下代码试试:
if geo is not None:
grid.add(geo, grid_bottom="60%", grid_left="60%")
if bar is not None:
grid.add(bar, grid_bottom="60%", grid_right="60%")
if geo2 is not None:
grid.add(geo2, grid_top="60%", grid_left="60%")
if wc is not None:
grid.add(wc, grid_top="60%", grid_right="60%")