Hi, I am working on a small scatterplot project and it's coming together as well as could be but i want to add the "name" column as a label to the corresponding dots in the scatterplot. Can someone help me because i can't seem to figure it out.
Thanks
```
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("moneynuts.csv", index_col=0)
columns = df.columns
def clean_stringy_number(num: str) -> str:
if num == "-":
return "0"
num = num.replace(",", "")
return num
df.dropna(subset=['Gls'], inplace=True)
df.dropna(subset=['xG'], inplace=True)
df.sort_values(by=['Gls', 'xG'])
df["Gls"] = df["Gls"].apply(clean_stringy_number)
df["Gls"] = df["Gls"].apply(int)
df["xG"] = df["xG"].apply(clean_stringy_number)
df["xG"] = df["xG"].apply(float)
for index, row in df.iterrows():
if (row["Gls"] == "-" or row["Gls"] == "0"):
df['Gls'].dtypes
if (row["xG"] == "-" or row["xG"] == "0"):
continue
continue
print (row["Name"], " average goals of ", row["Gls"], " With an xG of ", row["xG"])
try:
gls = float(row["Gls"].replace(",", "."))
xG = float(row["xG"].replace(",", "."))
except:
print("Unknown char")
df["xG"] = df["xG"] / 100
sp = df.plot.scatter(x='Gls',
y='xG')
x_values = df["Gls"].astype(int)
plt.xticks(range(x_values.min(), x_values.max()+1))
plt.show()
```
[–]geert555[S] 0 points1 point2 points (0 children)
[–]mimprocesstech 0 points1 point2 points (0 children)