The scatter plot is not showing the name of the person next to every data point in the plot.
I am trying to draw a scatter plot of salary and bonus. The only thing that is missing is the name of each employee at every data point in the plot.
Reeving a TypeError: cannot concatenate 'str' and 'tuple' objects
fig, ax = plt.subplots()
my_scatter_plot = ax.scatter(
df["salary"],
df["bonus"]
)
ax.set_xlabel("Salary")
ax.set_ylabel("Bonus")
ax.set_title("Enron Employees Salary and Bonus Scatter Plot")
for _, row in df[["Names","salary","bonus"]].iterrows():
xy = row[["salary", "bonus"]]
xytext= xy + (0.02, 5)
ax.annotate(row["Names"], xy, xytext)
plt.show()
TypeError: cannot concatenate 'str' and 'tuple' objects
Expecting to see name of every data that correspond to the employee.