title: HeatMap visualization
body: <p>I have a dataframe  df1</p>
  
  <pre><code>df1.info() 
  
  
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  RangeIndex: 38840 entries, 0 to 38839
  Data columns (total 7 columns):
  TIMESTAMP                 38840 non-null datetime64[ns]
  ACT_TIME_AERATEUR_1_F1    38696 non-null float64
  ACT_TIME_AERATEUR_1_F3    38697 non-null float64
  ACT_TIME_AERATEUR_1_F5    38695 non-null float64
  ACT_TIME_AERATEUR_1_F6    38695 non-null float64
  ACT_TIME_AERATEUR_1_F7    38693 non-null float64
  ACT_TIME_AERATEUR_1_F8    38696 non-null float64
  dtypes: datetime64[ns](1), float64(6)
  memory usage: 2.1 MB
  </code></pre>
  
  <p>which looks like this : </p>
  
  <pre><code> TIMESTAMP ACT_TIME_AERATEUR_1_F1 ACT_TIME_AERATEUR_1_F3 ACT_TIME_AERATEUR_1_F5 ACT_TIME_AERATEUR_1_F6 ACT_TIME_AERATEUR_1_F7
   ACT_TIME_AERATEUR_1_F8
   2015-08-01 05:10:00 100 100 100 100 100 100
   2015-08-01 05:20:00 100 100 100 100 100 100
   2015-08-01 05:30:00 100 100 100 100 100 100
   2015-08-01 05:40:00 100 100 100 100 100 100
  </code></pre>
  
  <p>I try to create a heatmap with seaborn to visualize data which are between two date ( for example here between '2015-08-01 23:10:00' and '2015-08-02 02:00:00') : 
  I do like this : </p>
  
  <pre><code>df1['TIMESTAMP']= pd.to_datetime(df_no_missing['TIMESTAMP'], '%d-%m-%y %H:%M:%S')
  df1['date'] = df_no_missing['TIMESTAMP'].dt.date
  df1['time'] = df_no_missing['TIMESTAMP'].dt.time
  date_debut = pd.to_datetime('2015-08-01 23:10:00')
  date_fin = pd.to_datetime('2015-08-02 02:00:00')
  
  df1 = df1[(df1['TIMESTAMP'] &gt;= date_debut) &amp; (df1['TIMESTAMP'] &lt; date_fin)]
  
  sns.heatmap(df1.iloc[:,1:6:],annot=True, linewidths=.5)
  </code></pre>
  
  <p>I got a heatmap like in the attached </p>
  
  <p><img src="https://i.stack.imgur.com/KnWie.png" alt="enter image description here"></p>
  
  <p>My question now is how can I replace the number in the left of the heatmap map (145...161) by their corresponding values of timestamp (2015-08-01 05:10:00, 2015-08-01 05:20:00, 2015-08-01 05:30:00, ...)</p>
  
  <p>Thank you</p>
  
  <p>Bests</p>
  
  <p>I try to make modifications : </p>
  
  <pre><code>df1.set_index("TIMESTAMP", inplace=1)
  sns.heatmap(df1.iloc[:, 1:6:], annot=True, linewidths=.5)
  ax = plt.gca()
  ax.set_yticklabels([i.strftime("%Y-%m-%d %H:%M:%S") for i in df1.TIMESTAMP], rotation=0)
  </code></pre>
  
  <p><strong>EDIT</strong> </p>
  
  <p>But I get error and warning : </p>
  
  <blockquote>
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\ipykernel\__main__.py:2:
  </code></pre>
    
    <p>SettingWithCopyWarning: 
        A value is trying to be set on a copy of a slice from a DataFrame.
        Try using .loc[row_indexer,col_indexer] = value instead</p>
  
  <pre><code>See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
    from ipykernel import kernelapp as app
  C:\Users\Demonstrator\Anaconda3\lib\site-packages\ipykernel\__main__.py:3:
  </code></pre>
    
    <p>SettingWithCopyWarning: 
        A value is trying to be set on a copy of a slice from a DataFrame.
        Try using .loc[row_indexer,col_indexer] = value instead</p>
  
  <pre><code>See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
    app.launch_new_instance()
  C:\Users\Demonstrator\Anaconda3\lib\site-packages\ipykernel\__main__.py:4:
  </code></pre>
    
    <p>SettingWithCopyWarning: 
        A value is trying to be set on a copy of a slice from a DataFrame.
        Try using .loc[row_indexer,col_indexer] = value instead</p>
  
  <pre><code>See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  
  
  
  
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-129-cec498d88cac&gt; in &lt;module&gt;()
        9 
       10 #sns.heatmap(df1.iloc[:,1:6:],annot=True, linewidths=.5)
  ---&gt; 11 sns.heatmap(df1.iloc[:, 1:6:], annot=True, linewidths=.5)
       12 ax = plt.gca()
       13 ax.set_yticklabels([i.strftime("%Y-%m-%d %H:%M:%S") for i in df1.TIMESTAMP], rotation=0)
  
  C:\Users\Demonstrator\Anaconda3\lib\site-packages\seaborn\matrix.py in
  </code></pre>
    
    <p>heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws,
    linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, ax,
    xticklabels, yticklabels, mask, **kwargs)
            483     plotter = _HeatMapper(data, vmin, vmax, cmap, center, robust, annot, fmt,
            484                           annot_kws, cbar, cbar_kws, xticklabels,
        --> 485                           yticklabels, mask)
            486 
            487     # Add the pcolormesh kwargs here</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\seaborn\matrix.py in
  </code></pre>
    
    <p><strong>init</strong>(self, data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, cbar, cbar_kws, xticklabels, yticklabels, mask)
            165         # Determine good default values for the colormapping
            166         self._determine_cmap_params(plot_data, vmin, vmax,
        --> 167                                     cmap, center, robust)
            168 
            169         # Sort out the annotations</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\seaborn\matrix.py in
  </code></pre>
    
    <p>_determine_cmap_params(self, plot_data, vmin, vmax, cmap, center, robust)
            204         calc_data = plot_data.data[~np.isnan(plot_data.data)]
            205         if vmin is None:
        --> 206             vmin = np.percentile(calc_data, 2) if robust else calc_data.min()
            207         if vmax is None:
            208             vmax = np.percentile(calc_data, 98) if robust else calc_data.max()</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\numpy\core\_methods.py
  </code></pre>
    
    <p>in _amin(a, axis, out, keepdims)
             27 
             28 def _amin(a, axis=None, out=None, keepdims=False):
        ---> 29     return umr_minimum(a, axis, None, out, keepdims)
             30 
             31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):</p>
  
  <pre><code>ValueError: zero-size array to reduction operation minimum which has no identity
  </code></pre>
  </blockquote>
  
  <p>@jeanrjc, look at the last image, there is a problem: the image is too small and there is two vertical line(scale)on the right. I hope that i'am clear now<a href="https://i.stack.imgur.com/yNrA8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yNrA8.png" alt="enter image description here"></a></p>