Clustering with KMeans -TSNE

Hello Python family

I am trying to cluster data using Kmeans. I reduced the dimensionality with TSNE. I am now trying to describe the characteristics of each cluster. I keep getting an error message for the feature ‘Age’.
I can confirm that this feature has no null values.
Please see below, the script and error message. Could you kindly tell me why I keep getting the key error message?
Many thanks

def outside_limit(df, label_col, label, sensitivity):
feature_list = X

plot_list =
mean_overall_list =
mean_cluster_list =

for i,varname in enumerate(feature_list):

#     get overall mean for a variable, set lower and upper limit
mean_overall = df[varname].mean()
lower_limit = mean_overall - (mean_overall*sensitivity)
upper_limit = mean_overall + (mean_overall*sensitivity)

#     get cluster mean for a variable
cluster_filter = df[label_col]==label
pd_cluster = df[cluster_filter]
mean_cluster = pd_cluster[varname].mean()

#     create filter to display graph with 0.5 deviation from the mean
if mean_cluster <= lower_limit or mean_cluster >= upper_limit:
  plot_list.append(varname)
  mean_overall_std = mean_overall/mean_overall
  mean_cluster_std = mean_cluster/mean_overall
  mean_overall_list.append(mean_overall_std)
  mean_cluster_list.append(mean_cluster_std)

mean_df = pd.DataFrame({‘feature_list’:plot_list,
‘mean_overall_list’:mean_overall_list,
‘mean_cluster_list’:mean_cluster_list})
mean_df = mean_df.sort_values(by=[‘mean_cluster_list’], ascending=False)

return mean_df

def plot_barchart_all_unique_features(df, label_col, label, ax, sensitivity):

mean_df = outside_limit(df, label_col, label, sensitivity)
mean_df_to_plot = mean_df.drop([‘mean_overall_list’], axis=1)

if len(mean_df.index) != 0:
sns.barplot(y=‘feature_list’, x=‘mean_cluster_list’, data=mean_df_to_plot, palette=sns.cubehelix_palette(20, start=.5, rot=-.75, reverse=True),
alpha=0.75, dodge=True, ax=ax)

for i,p in enumerate(ax.patches):
  ax.annotate("{:.02f}".format((p.get_width())), 
              (1, p.get_y() + p.get_height() / 2.), xycoords=('axes fraction', 'data'),
              ha='right', va='top', fontsize=10, color='black', rotation=0, 
              xytext=(0, 0),
              textcoords='offset pixels')

ax.set_title('Unique Characteristics of Cluster ’ + str(label))
ax.set_xlabel(‘Standardized Mean’)
ax.axvline(x=1, color=‘k’)

def plot_features_all_cluster(df, label_col, n_clusters, sensitivity):
n_plot = n_clusters
fig, ax = plt.subplots(n_plot, 1, figsize=(12, n_plot*6), sharex=‘col’)
ax= ax.ravel()

label = np.arange(n_clusters)
for i in label:
plot_barchart_all_unique_features(df, label_col, label=i, ax=ax[i], sensitivity=sensitivity)
ax[i].xaxis.set_tick_params(labelbottom=True)

plt.tight_layout()
display(fig)

plot_features_all_cluster(df=clusters_tsne_scale, label_col=‘cluster’, n_clusters=4, sensitivity=0.2)

output:

--------------------------------------------------------------------------- KeyError Traceback (most recent call last) ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 2645 try: → 2646 return self._engine.get_loc(key) 2647 except KeyError: pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() KeyError: ‘Age’ During handling of the above exception, another exception occurred: KeyError Traceback (most recent call last) in ----> 1 plot_features_all_cluster(df=clusters_tsne_scale, label_col=‘cluster’, n_clusters=4, sensitivity=0.2) in plot_features_all_cluster(df, label_col, n_clusters, sensitivity) 61 label = np.arange(n_clusters) 62 for i in label: —> 63 plot_barchart_all_unique_features(df, label_col, label=i, ax=ax[i], sensitivity=sensitivity) 64 ax[i].xaxis.set_tick_params(labelbottom=True) 65 in plot_barchart_all_unique_features(df, label_col, label, ax, sensitivity) 36 def plot_barchart_all_unique_features(df, label_col, label, ax, sensitivity): 37 —> 38 mean_df = outside_limit(df, label_col, label, sensitivity) 39 mean_df_to_plot = mean_df.drop([‘mean_overall_list’], axis=1) 40 in outside_limit(df, label_col, label, sensitivity) 10 11 # get overall mean for a variable, set lower and upper limit —> 12 mean_overall = df[varname].mean() 13 lower_limit = mean_overall - (mean_overallsensitivity) 14 upper_limit = mean_overall + (mean_overallsensitivity) ~\Anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 2798 if self.columns.nlevels > 1: 2799 return self._getitem_multilevel(key) → 2800 indexer = self.columns.get_loc(key) 2801 if is_integer(indexer): 2802 indexer = [indexer] ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 2646 return self._engine.get_loc(key) 2647 except KeyError: → 2648 return self._engine.get_loc(self._maybe_cast_indexer(key)) 2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance) 2650 if indexer.ndim > 1 or indexer.size > 1: pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() KeyError: ‘Age’