作为我上一个问题的扩展
使用相同的数据集,我无法完成注释。
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()
错误:
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'
请提出可能的解决方法?
annot=True
是的参数heatmap
,而不是pivot_table
:
sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00'),
annot=True)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句