title: SciKit TypeError: Cannot cast array data from dtype('float64') to dtype(' u32') according to the rule 'safe'
body: <p>I'm using the sklearn library with the following code, and get the error mentioned in the title. The code works if I uses non-linear classifiers (such as DecisionTreeClassifier or KNeighborsClassifier) but with linear_model classifiers like SGD and PassiveAggressive I get the error. I've tried mapping the array contents to floats but it does not work. All the contents of the array are 'numpy.unicode_'. I would appreciate help in resolving this issue.</p>
  
  <p>The code:</p>
  
  <pre><code>from io import open
  from os import listdir
  import numpy as np
  
  path = "address"
  months = listdir(path)
  for month in months:
      if "_sanitized" in month:
          files = listdir (path + month)
          for file in files:
              temp_path = path + month + "\\" + file
              text = open (temp_path, "r").read()
              lines = text.split("\n")
              attr_train = list()
              label_train = list()
              go = False
              for line in lines:
                  if line != "" and not go:
                      row = line.split()
                      label_train.append(row[-1])
                      go = (row[-1] != u'-1')
                      del row[-1]
                      attr_train.append(row)
              label_train_arr = np.asarray(label_train)
          attr_train_arr = np.asarray(attr_train)
          break
      break
  
  from sklearn.model_selection import train_test_split
  from sklearn import preprocessing
  
  le = preprocessing.LabelEncoder()
  
  for arr in range(len(attr_train_arr)):
      newArr = le.fit_transform(attr_train_arr[arr])
      attr_train_arr[arr] = newArr
  
  label_train_arr = map(float, label_train_arr)
  for arr in attr_train_arr:
      arr = map(float, arr)
  x = attr_train_arr
  y = label_train_arr
  
  X_train, X_test, Y_train, Y_test = train_test_split(x, y, test_size = .5)
  print "after split"
  
  from sklearn.linear_model import SGDClassifier
  #my_classifier = SGDClassifier()
  
  from sklearn.linear_model import PassiveAggressiveClassifier
  my_classifier = PassiveAggressiveClassifier()
  
  my_classifier.fit(X_train, Y_train)
  print "after fit"
  
  predictions = my_classifier.predict(X_test)
  </code></pre>