pandas profilingの日本語対応

Source Code Software ComputerIT全般

streamlitとpandas profilingを組み合わせようとしていました。

pandas profilingは便利なライブラリですが、日本語が豆腐になってしまうのでその対応方法についてです。

対応方法

seabornの設定を書き換えてやる必要があります。

site-packagesにある、seabornフォルダのrcmod.pyを編集します。

#87行目あたり 書き換え前
font="sans-serif", font_scale=1,color_codes=True,rc=None):
# 87行目あたり 書き換え後
font="Yu Gothic", font_scale=1,color_codes=True,rc=None):

# 205行目当たり書き換え前
"font.family": ["sans-serif"],
# 205行目当たり書き換え後
"font.family": ["Yu Gothic"],

macだと”Yu Gothic”がないので、”Hiragino Sans”あたりが良いかと思います。

コメント

タイトルとURLをコピーしました