title: Unable to transform string column to categorical matrix using Keras and Sklearn
body: <p>I am trying to build a simple Keras model, with Python3.6 on MacOS, to predict house prices in a given range but I fail to transform the output into a category matrix. I am using <a href="https://www.kaggle.com/anthonypino/melbourne-housing-market" rel="nofollow noreferrer">this dataset</a> from Kaggle.</p>
  
  <p>I've created a new column in the dataframe with different price ranges as strings to serve as target output in my model, then use keras.utils and Sklearn LabelEncoder to try to create the output binary matrix but I keep getting the error:</p>
  
  <pre><code>ValueError: invalid literal for int() with base 10: '0 - 50000'
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  from keras.layers import Dense
  from keras.models import Sequential, load_model
  from keras.callbacks import EarlyStopping
  from keras.utils import to_categorical, np_utils
  import matplotlib.pyplot as plt
  from sklearn.preprocessing import LabelEncoder
  
  seed = 7
  np.random.seed(seed)
  
  data = pd.read_csv("Melbourne_housing_FULL.csv")
  data.fillna(0, inplace=True)
  
  price_range = 50000
  bins = np.arange(0, 12000000, price_range)
  labels = ['{} - {}'.format(i + 1, j) for i, j in zip(bins[:-1], bins[1:])] 
  
  #correct first value 
  labels[0] = '0 - 50000'
  
  for item in labels:
      str(item)
  
  print (labels[:10])
  ['0 - 50000', '50001 - 100000', '100001 - 150000', '150001 - 200000', 
   '200001 - 250000', '250001 - 300000', '300001 - 350000', '350001 - 400000', 
   '400001 - 450000', '450001 - 500000']
  
  data['PriceRange'] = pd.cut(data.Price, 
                              bins=bins, 
                              labels=labels, 
                              right=True, 
                              include_lowest=True)
  
  #print(data.PriceRange.value_counts())
  output_len = len(labels)
  print(output_len)
  </code></pre>
  
  <p>Everything is correct here until I run the next piece:</p>
  
  <pre><code>predictors = data.drop(['Suburb', 'Address', 'SellerG', 'CouncilArea', 
                          'Propertycount', 'Date', 'Type', 'Price', 'PriceRange'], axis=1).as_matrix()
  
  target = data['PriceRange']
  
  
  # encode class values as integers
  encoder = LabelEncoder()
  encoder.fit(target)
  encoded_Y = encoder.transform(target)
  
  target = np_utils.to_categorical(data.PriceRange)
  
  n_cols = predictors.shape[1]
  </code></pre>
  
  <p>And I get the ValueError: invalid literal for int() with base 10: '0 - 50000'</p>
  
  <p>Con someone help me here? Don't really understand what I am doing wrong.</p>
  
  <p>Many thanks</p>