您好:
程式碼如下:
要用資料作地熱圖,但df.corr()時出現
ValueError: could not convert string to float: 'ffwind (培)'
資料來源部分資料:
author,pushes,comments,images
ffwind (培),347,681,4
haohao1201 (豪神),1,3,16
Black3831372 (男哥是我),5,7,37
meokay (我可以),5,8,3
maxxxxxx (馬克思),106,115,15
ReiKuromiya (Rei Kuromiya),7,10,4
fack3170 (Jくん),5,7,22
請問,這要如何處理?
謝謝
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# 匯入CSV格式的檔案
df = pd.read_csv("pttbeauty2.csv", encoding="utf8")
#sns.pairplot(df, kind="scatter", diag_kind="hist")
#plt.show()
#print( df )
sns.heatmap(df.corr(), annot=True, fmt=".2f")
plt.show()