import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
Data = pd.read_csv("C:/tmp/zufall.txt", header=0)
print(list(Data.columns))
kNN = pd.DataFrame(
[[9, 9,"c"],
[11, 11,"c"],
[11, 9,"c"],
[9, 11,"c"]],
columns=['X','Y','Klasse'])
pPlot = Data[Data.Klasse=='a'].plot(kind='scatter',x='X',y='Y',color='blue', label='Klasse a')
Data[Data.Klasse=='b'].plot(kind='scatter',x='X',y='Y',color='red', label='Klasse b',ax=pPlot)
kNN[kNN.Klasse=='c'].plot(kind='scatter',x='X',y='Y',color='green', label='Klasse c', ax=pPlot)
pPlot.set_xlabel("ein paar x Werte")
pPlot.set_ylabel("ein paar y Werte")
pPlot.set_title("zufällige Punkte")
pPlot=plt.gcf()
pPlot.set_size_inches(6,6)
plt.show()
testX = kNN.iloc[0,0]
testY = kNN.iloc[0,1]
testKlasse = kNN.iloc[0,2]
print("kNN von ", testX, testY, testKlasse)
zufall