0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ヒートマップ作成

Posted at

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns


def make_heatmap(sale_data):
    df = pd.DataFrame(sale_data, columns=["b", "c", "value"])
    df_pivot = df.pivot(index="b", columns="c", values="value")

    plt.figure(figsize=(12, 9))
    sns.heatmap(df_pivot, annot=True, fmt="g", cmap="Greens")
    plt.show()


def main():
    sale_data = [[1, 2, 3], [2, 3, 5], [4, 3, 2], [2, 4, 5], [1, 5, 1]]

    make_heatmap(sale_data)


if __name__ == "__main__":
    main()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?