热图 Seaborn Annot 错误
Heat Maps Seaborn Annot Error
作为我之前
的延伸
使用相同的数据集我无法完成注释。
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)
作为我之前
使用相同的数据集我无法完成注释。
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)