为我最后一年的项目做一个计划。 该程序从.csv数据集中获取经度和纬度坐标,并将其绘制在地图上。 我遇到的问题是有多个ID,总计445000+分
我如何改进它,使程序能够区分ID
def create_image(self, color, width=2):
# Creates an image that contains the Map and the GPS record
# color = color the GPS line is
# width = width of the GPS line
data = pd.read_csv(self.data_path, header=0)
# sep will separate the latitude from the longitude
data.info()
self.result_image = Image.open(self.map_path, 'r')
img_points = []
gps_data = tuple(zip(data['latitude'].values, data['longitude'].values))
for d in gps_data:
x1, y1 = self.scale_to_img(d, (self.result_image.size[0], self.result_image.size[1]))
img_points.append((x1, y1))
draw = ImageDraw.Draw(self.result_image)
draw.line(img_points, fill=color, width=width)
我还附加了程序工作的github project here,但我只是想尽量减少它一次打印多少用户
提前谢谢
要检查特定ID,可以创建一个筛选器。对于此数据帧
您可以执行以下操作:
这可用于从数据帧中筛选出ID为“test1”的每个条目
相关问题 更多 >
编程相关推荐