title: TypeError: '<' not supported between instances of 'str' and 'int' while doing PCA for k-means clustering
body: <p>I am trying to apply Kernel Principle Component Analysis on a dataset without a dependent variable to do a cluster analysis with k-means, so that I can learn how to do so. Here is a sample of my dataset(according to the scenario, this is a dataset of a shopping mall, and the shopping mall wants to discover the segments of its customers according to the data below):</p>
  
  <pre><code>CustomerID  Genre   Age Annual Income (k$)  Spending Score (1-100)
      1   Male    19  15  39
      2   Male    21  15  81
      3   Female  20  16  6
      4   Female  23  16  77
      5   Female  31  17  40
      6   Female  22  17  76
      7   Female  35  18  6
      8   Female  23  18  94
      9   Male    64  19  3
      10  Female  30  19  72
      11  Male    67  19  14
  </code></pre>
  
  <p>First, I omitted CustomerID column and then encoded the gender column to be able to apply kernel PCA. Here is how I did it:</p>
  
  <pre><code># Importing the libraries
  import numpy as np
  import matplotlib.pyplot as plt
  import pandas as pd
  
  # Importing the mall dataset with pandas
  dataset = pd.read_csv('Mall_Customers.csv')
  X = dataset.iloc[:, 1:5].values
  df = pd.DataFrame(X)
  #df is in order to visualize the "X" on variable explorer
  
  #Encoding independent categorical variables 
  from sklearn.preprocessing import LabelEncoder, OneHotEncoder
  labelencoder_X = LabelEncoder()
  X[:, 0] = labelencoder_X.fit_transform(X[:, 0])
  onehotencoder = OneHotEncoder(categorical_features = [0])
  X = onehotencoder.fit_transform(X).toarray()
  </code></pre>
  
  <p>After executing this code, I could get the array with float64 Type. The sample from the array I created is below:</p>
  
  <pre><code>0   1   19  15  39
  0   1   21  15  81
  1   0   20  16  6
  1   0   23  16  77
  1   0   31  17  40
  1   0   22  17  76
  1   0   35  18  6
  1   0   23  18  94
  0   1   64  19  3
  1   0   30  19  72
  0   1   67  19  14
  </code></pre>
  
  <p>And then, I wanted to apply Kernel PCA to get the principal components which I will use at k-means. However, when I try to execute the code below, I get the error "TypeError: '&lt;' not supported between instances of 'str' and 'int'". </p>
  
  <pre><code># Applying Kernel PCA 
  from sklearn.decomposition import KernelPCA
  kpca = KernelPCA(n_components = 'None', kernel = 'rbf')
  X = kpca.fit_transform(X)
  explained_variance = kpca.explained_variance_ratio_
  </code></pre>
  
  <p>Even if I encoded my categorical data and I don't have any strings in my dataset, I cannot understand why it gives this error. Is there anyone that could help?</p>
  
  <p>Thank you very much in advance.</p>