0

I would like to plot X and Y coordinates as points. The Points shall have different colours depending on what "Player" they are. My data comes from a CSV dataframe.

An amazing extra would be to calculate the sum of the distance between each point of the Player (example player 0: distance first point - secont point + distance second point - third point ...)

import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt


df = pd.read_csv("test2.csv")



df.rename(columns = {"Unnamed: 0":"Zeile", "0":"Spieler", "1":"XY"},inplace = True)

df.sort_values(by="Spieler", inplace = True)
df

This is my data atm:

    Zeile   Spieler XY
0   0   0   [1071, 117]
400 400 0   [1071, 118]
181 181 0   [1072, 121]
381 381 0   [1071, 120]
226 226 0   [1072, 120]
438 438 0   [1071, 118]
28  28  0   [1071, 117]
271 271 0   [1071, 120]
457 457 0   [1072, 119]
454 454 16  [1139, 80]
416 416 16  [1140, 80]
492 492 16  [1140, 80]
511 511 16  [1139, 80]
512 512 17  [885, 310]
341 341 17  [881, 315]
Mohammad hp
  • 446
  • 4
  • 16
Herr Mann
  • 1
  • 1

0 Answers0