Seaborn Heatmap With Single Column
I have a dataframe that has an index (words) and a single column (counts) for some lyrics. I am trying to create a heatmap based on the word counts. Cuenta Que 179 La 145 Y
Solution 1:
The data is one-dimensional. The counts are already present in the one (and only) column of the dataframe. There is no meaningless way to pivot this data.
You would hence directly plot the dataframe as a heatmap.
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.DataFrame({"Cuenta": [179,145,142,113,108]},
index=["Que", "La", "Y", "Me", "No"])
sns.heatmap(df, annot=True, fmt="g", cmap='viridis')
plt.show()
Baca Juga
- Have Gradient Colours In Sns.pairplot For One Column Of Dataframe So That I Can See Which Datapoints Are Connected To Each Other
- Seaborn Heatmap Is Generating Additional Ticks On Colorbar When Using Log Scale
- Why The Model Is Training On Only 1875 Training Set Images If There Are 60000 Images In The Mnist Dataset?
Post a Comment for "Seaborn Heatmap With Single Column"