title: TypeError: Image data of dtype object cannot be converted to float - Issue with HeatMap Plot using Seaborn
body: <p>I'm getting the error:</p>
  
  <pre><code>TypeError: Image data of dtype object cannot be converted to float
  </code></pre>
  
  <p>when I try to run the <code>heapmap</code> function in the code below:</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import pandas as pd
  import seaborn as sns
  import matplotlib.pyplot as plt
  
  # Read the data 
  df = pd.read_csv("gapminder-FiveYearData.csv")
  print(df.head(10))
  
  # Create an array of n-dimensional array of life expectancy changes for countries over the years.
  year = ((np.asarray(df['year'])).reshape(12,142))
  country = ((np.asarray(df['country'])).reshape(12,142))
  
  print(year)
  print(country)
  
  # Create a pivot table
  result = df.pivot(index='year',columns='country',values='lifeExp')
  print(result)
  
  # Create an array to annotate the heatmap
  labels = (np.asarray(["{1:.2f} \n {0}".format(year,value)
                        for year, value in zip(year.flatten(),
                                                 country.flatten())])
           ).reshape(12,142)
  
  # Define the plot
  fig, ax = plt.subplots(figsize=(15,9))
  
  # Add title to the Heat map
  title = "GapMinder Heat Map"
  
  # Set the font size and the distance of the title from the plot
  plt.title(title,fontsize=18)
  ttl = ax.title
  ttl.set_position([0.5,1.05])
  
  # Hide ticks for X &amp; Y axis
  ax.set_xticks([]) 
  ax.set_yticks([]) 
  
  # Remove the axes
  ax.axis('off')
  
  # Use the heatmap function from the seaborn package
  hmap = sns.heatmap(result,annot=labels,fmt="",cmap='RdYlGn',linewidths=0.30,ax=ax)
  
  # Display the Heatmap
  plt.imshow(hmap)
  
  </code></pre>
  
  <p><a href="https://raw.githubusercontent.com/resbaz/r-novice-gapminder-files/master/data/gapminder-FiveYearData.csv" rel="nofollow noreferrer">Here</a> is a link to the CSV file.</p>
  
  <p>The objective of the activity is to </p>
  
  <ol>
  <li><p>data file is the dataset with 6 columns namely: country, year, pop, continent, <code>lifeExp</code> and <code>gdpPercap</code>.  </p></li>
  <li><p>Create a pivot table dataframe with year along x-axes, country along y-axes and <code>lifeExp</code> filled within cells.</p></li>
  <li><p>Plot a heatmap using seaborn for the pivot table that was just created.</p></li>
  </ol>