title: TypeError : Image data can not be converted to float
body: <p>I imported a csv file using pandas in python. It had all the pixel values in a string in a single column so I split it using dataframe. But now when I am trying to plot the image from the dataset i am getting this error</p>
  
  <pre><code>raise TypeError("Image data cannot be converted to float")
  
  TypeError: Image data cannot be converted to 
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import numpy as np # linear algebra
  import pandas as pd 
  
  df_train = pd.read_csv('/root/Downloads/Deep-Learning/Projects/train.csv')
  df_test = pd.read_csv('/root/Downloads/Deep-Learning/Projects/test.csv')
  
  from keras.models import Sequential
  from keras.layers import Dense, Dropout, Flatten
  from keras.layers.convolutional import Conv2D, MaxPooling2D
  from keras.utils import np_utils
  from keras.optimizers import RMSprop
  from keras.callbacks import ReduceLROnPlateau
  from keras.preprocessing.image import ImageDataGenerator
  import matplotlib.pyplot as plt
  from sklearn.model_selection import train_test_split
  
  df_train.head()
  
  #every columns but the first
  df_train_x = df_train.iloc[:,1:]
  #only the first column
  df_train_y = df_train.iloc[:,:1]
  
  df_train_x = pd.DataFrame(df_train_x.Pixels.str.split(' ',2303).tolist())
  
  ax = plt.subplots(1,5)
  for i in range(0,5):   #validate the first 5 records
      ax[1][i].imshow(df_train_x.values[i].reshape(48,48), cmap='gray')
      ax[1][i].set_title(df_train_y.values[i])
  </code></pre>
  
  <p>What should I do?</p>