[英]how to merge two maps using python
Fairly new to python so this may seem noobish. python 相当新,所以这可能看起来很无聊。 I have created two basic maps in.line format (new to me), each showing different features using matplotlib.我创建了两个基本的 in.line 格式的地图(对我来说是新的),每个都使用 matplotlib 显示不同的功能。 These maps were converted from separate shapefiles.这些地图是从单独的 shapefile 转换而来的。 Now I need to merge these two.line maps into one.现在我需要将这两个线图合并为一个。
Any ideas would be highly appreciated.任何想法将不胜感激。 TY.泰。
In Python 3.5 or greater:在Python 3.5或更高版本中:
z = {**x, **y}
In Python 2, (or 3.4 or lower) write a function:在Python 2(或 3.4 或更低版本)中写入 function:
def merge_two_dicts(x, y):
z = x.copy() # start with x's keys and values
z.update(y) # modifies z with y's keys and values & returns None
return z
z = merge_two_dicts(x, y)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.