title: Keras - ValueError: could not convert string to float
body: <p>I have the code shown below, but get the following error:</p>
  
  <blockquote>
    <p>ValueError: could not convert string to float: BRAF</p>
  </blockquote>
  
  <p>Provided that this is a sample of my data (<code>|</code> is just a separator I added here for demonstration, you can imagine each value in a separate cell in a CSV file):</p>
  
  <blockquote>
    <p>c.401C>T | skin | 23:141905805-141905805 | 9947 | BRAF</p>
  </blockquote>
  
  <p>Could the strings be the issue? How can I read and pass strings in this case?</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense
  from keras.models import Sequential, load_model
  from keras.layers import Dense, Dropout, BatchNormalization, Activation
  from keras.wrappers.scikit_learn import KerasRegressor
  
  from sklearn.cross_validation import train_test_split
  import pandas as pd
  import numpy as np
  
  df1 = pd.read_csv('mutation-train.csv')
  y = df1[['Histology']]
  X = df1[["CDS_Mutation","Primary_Tissue","Genomic","Gene_ID","Official_Symbol"]]
  
  X = X.astype(np.str).values
  y = y.astype(np.str).values
  
  df2 = pd.read_csv('mutation-test.csv')
  
  X_Test = df2[["CDS_Mutation","Primary_Tissue","Genomic","Gene_ID","Official_Symbol"]]
  X_Test = X_Test.astype(np.str).values
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.2)
  
  seed = 42
  np.random.seed(seed)
  
  model = Sequential()
  #input layer
  model.add(Dense(8, input_shape=(5,)))
  model.add(BatchNormalization())
  model.add(Activation("relu"))
  model.add(Dropout(0.4))
  
  model.add(Dense(8))
  model.add(BatchNormalization())
  model.add(Activation("sigmoid"))
  model.add(Dropout(0.4))
  
  model.add(Dense(4))
  model.add(BatchNormalization())
  model.add(Activation("sigmoid"))
  model.add(Dropout(0.4))
  
  model.add(Dense(2, activation="sigmoid"))
  
  model.add(Dense(1, activation='linear'))
  
  model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  
  model.fit(X, y, nb_epoch=300, batch_size=30)
  </code></pre>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is the traceback:</p>
  
  <pre><code>File "my_code.py", line 16, in &lt;module&gt;
      df1 = pd.read_csv('mutation-train.csv',header=None,names=headers, dtype=dtypes)
    File "/Users/abder/anaconda2/lib/python2.7/site-packages/pandas/io/parsers.py", line 678, in parser_f
      return _read(filepath_or_buffer, kwds)
    File "/Users/abder/anaconda2/lib/python2.7/site-packages/pandas/io/parsers.py", line 446, in _read
      data = parser.read(nrows)
    File "/Users/abder/anaconda2/lib/python2.7/site-packages/pandas/io/parsers.py", line 1036, in read
      ret = self._engine.read(nrows)
    File "/Users/abder/anaconda2/lib/python2.7/site-packages/pandas/io/parsers.py", line 1848, in read
      data = self._reader.read(nrows)
    File "pandas/_libs/parsers.pyx", line 876, in pandas._libs.parsers.TextReader.read
    File "pandas/_libs/parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory
    File "pandas/_libs/parsers.pyx", line 968, in pandas._libs.parsers.TextReader._read_rows
    File "pandas/_libs/parsers.pyx", line 1094, in pandas._libs.parsers.TextReader._convert_column_data
    File "pandas/_libs/parsers.pyx", line 1162, in pandas._libs.parsers.TextReader._convert_tokens
  </code></pre>