I'm trying to plot a series of IP addresses within a scatter plot and then label them based on their 'detections' which are either 0 or greater than 0.
Although this plot does get generated, it colours all points the same, rather than separating them by the label of malicious, any help is much appreciated!
df = pd.io.sql.read_sql('SELECT Date_scanned, IP, Detections FROM URLs', con=conn)
df['Date_scanned']=df['Date_scanned'].str.split(" ").str[0]
detections = df['Detections'].values
for row in df:
for x in detections:
if x > 0:
malicious = "Yes"
else:
malicious = "No"
plt.scatter(df['Date_scanned'], df['IP'], label=malicious)
plt.legend(loc='best')
plt.show()