I am writing a python code, it should read the values of columns but I am getting the KeyError: 'column_name' error. Can anyone please tell me how to fix this issue.
import numpy as np
from sklearn.cluster import KMeans
import pandas as pd### For the purposes of this example, we store feature data from our
### dataframe `df`, in the `f1` and `f2` arrays. We combine this into
### a feature matrix `X` before entering it into the algorithm.df = pd.read_csv(r'C:\Users\Desktop\data.csv')print (df)#df = pd.read_csv(csv_file)"""
saved_column = df.Distance_Feature
saved_column = df.Speeding_Featureprint(saved_column)
"""f1 = df['Distance_Feature'].tolist()
f2 = df['Speeding_Feature'].tolist()print(f1)
print(f2)X=np.matrix(zip(f1,f2))print(X)kmeans = KMeans(n_clusters=2).fit(X)
Can anyone please help me.