Heatmaps Seaborn Annot Error

As an extension to my previous question

On the same dataset, I cannot perform the annotation.

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set()

df = pd.read_csv('heat_map_data.csv')

df3 = df.copy()
for c in ['Place','Name']:
    df3[c] = df3[c].astype('category')

sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00', annot=True) )

plt.show() 

      

Mistake:

Traceback (most recent call last):
  File "heatmap_sns.py", line 13, in <module>
    sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00', annot=True) )
TypeError: pivot_table() got an unexpected keyword argument 'annot'

      

Please tell me what could be the fix?

0


source to share


1 answer


annot=True

is an argument heatmap

, not pivot_table

:



sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00'), 
            annot=True)

      

+1


source







All Articles