Support for visualizations with chinese characters

Author: patrickstar231Created Mar 14, 2025Updated Sep 30, 2026
Labelsfeature request 💬

Current Behaviour

Objective: To resolve the issue of displaying Chinese characters in Seaborn and WordCloud. I modified visualisation\context.py by adding a new value 'Microsoft YaHei' to the font.sans-serif list. I also modified seaborn\rcmod.py by adding 'Microsoft YaHei' to the font.sans-serif list. At this point, the Chinese characters in the heatmap displayed in the report were shown correctly. However, after further modifications: In visualisation\plot.py, I changed the wordcloud to: Python wordcloud = WordCloud(background_color="white", random_state=123, width=300, height=200, scale=2, font_path=r'C:\Windows\Fonts\simhei.ttf').generate_from_frequencies(word_dict) After this change, the Chinese characters in the heatmap were no longer displayed correctly, while the word cloud was displayed correctly.

Expected Behaviour

Objective: To resolve the issue of displaying Chinese characters in Seaborn and WordCloud. I modified visualisation\context.py by adding a new value 'Microsoft YaHei' to the font.sans-serif list. I also modified seaborn\rcmod.py by adding 'Microsoft YaHei' to the font.sans-serif list. At this point, the Chinese characters in the heatmap displayed in the report were shown correctly. However, after further modifications: In visualisation\plot.py, I changed the wordcloud to: Python wordcloud = WordCloud(background_color="white", random_state=123, width=300, height=200, scale=2, font_path=r'C:\Windows\Fonts\simhei.ttf').generate_from_frequencies(word_dict) After this change, the Chinese characters in the heatmap were no longer displayed correctly, while the word cloud was displayed correctly.

Data Description

开始日期 周几 结束日期 结束日期 周几 排名 关键词 综合指数 搜索指数 视频量 单视频指数 综合指数/搜索*视频量 每日综合指数 每日搜索指数 每日视频量
星期三 2025/2/7 星期五 1 黄金 6742055 19361072 320000 21.07 111432.76 2247351.67 6453690.67 106666.67

Code that reproduces the bug

python

pandas-profiling version

v4.14

Dependencies

# Name                    Version                   Build  Channel
annotated-types           0.6.0            py39hca03da5_0  
asttokens                 3.0.0              pyhd8ed1ab_1    conda-forge
attrs                     24.3.0           py39hca03da5_0  
blas                      1.0                    openblas  
bottleneck                1.4.2            py39hbda83bc_0  
brotli-python             1.0.9            py39h313beb8_9  
ca-certificates           2025.2.25            hca03da5_0  
certifi                   2025.1.31          pyhd8ed1ab_0    conda-forge
charset-normalizer        3.3.2              pyhd3eb1b0_0  
contourpy                 1.2.1            py39h48ca7d4_1  
cycler                    0.11.0             pyhd3eb1b0_0  
dacite                    1.8.1            py39hca03da5_0  
decorator                 5.2.1              pyhd8ed1ab_0    conda-forge
et-xmlfile                2.0.0                    pypi_0    pypi
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
executing                 2.1.0              pyhd8ed1ab_1    conda-forge
fonttools                 4.55.3           py39h80987f9_0  
freetype                  2.12.1               h1192e45_0  
htmlmin                   0.1.12             pyhd3eb1b0_1  
idna                      3.7              py39hca03da5_0  
imagehash                 4.3.1            py39hca03da5_0  
importlib-metadata        8.5.0            py39hca03da5_0  
importlib_metadata        8.5.0                hd3eb1b0_0  
importlib_resources       6.4.0            py39hca03da5_0  
ipython                   8.18.1             pyh707e725_3    conda-forge
jedi                      0.19.2             pyhd8ed1ab_1    conda-forge
jinja2                    3.1.5            py39hca03da5_0  
joblib                    1.4.2            py39hca03da5_0  
jpeg                      9e                   h80987f9_3  
kiwisolver                1.4.4            py39h313beb8_0  
lcms2                     2.16                 he93ba84_0  
lerc                      4.0.0                h313beb8_0  
libcxx                    14.0.6               h848a8c0_0  
libdeflate                1.22                 h80987f9_0  
libffi                    3.4.4                hca03da5_1  
libgfortran               5.0.0           11_3_0_hca03da5_28  
libgfortran5              11.3.0              h009349e_28  
libllvm14                 14.0.6               h19fdd8a_4  
libopenblas               0.3.21               h269037a_0  
libpng                    1.6.39               h80987f9_0  
libtiff                   4.5.1                hc9ead59_1  
libwebp-base              1.3.2                h80987f9_1  
llvm-openmp               14.0.6               hc6e5704_0  
llvmlite                  0.43.0           py39h313beb8_1  
lz4-c                     1.9.4                h313beb8_1  
markupsafe                3.0.2            py39h80987f9_0  
matplotlib-base           3.8.4            py39h46d7db6_0  
matplotlib-inline         0.1.7              pyhd8ed1ab_1    conda-forge
multimethod               1.9.1            py39hca03da5_0  
ncurses                   6.4                  h313beb8_0  
networkx                  3.2.1            py39hca03da5_0  
numba                     0.60.0           py39h313beb8_1  
numexpr                   2.10.1           py39h5d9532f_0  
numpy                     1.26.4           py39h3b2db8e_0  
numpy-base                1.26.4           py39ha9811e2_0  
openjpeg                  2.5.2                h54b8e55_0  
openpyxl                  3.1.5                    pypi_0    pypi
openssl                   3.4.1                h81ee809_0    conda-forge
packaging                 24.2             py39hca03da5_0  
pandas                    2.2.3            py39hcf29cfe_0  
parso                     0.8.4              pyhd8ed1ab_1    conda-forge
patsy                     1.0.1            py39hca03da5_0  
pexpect                   4.9.0              pyhd8ed1ab_1    conda-forge
phik                      0.12.3           py39h48ca7d4_0  
pickleshare               0.7.5           pyhd8ed1ab_1004    conda-forge
pillow                    11.1.0           py39h84e58ab_0  
pip                       25.0             py39hca03da5_0  
prompt-toolkit            3.0.50             pyha770c72_0    conda-forge
ptyprocess                0.7.0              pyhd8ed1ab_1    conda-forge
pure_eval                 0.2.3              pyhd8ed1ab_1    conda-forge
pybind11-abi              4                    hd3eb1b0_1  
pydantic                  2.10.3           py39hca03da5_0  
pydantic-core             2.27.1           py39h2aea54e_0  
pygments                  2.19.1             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9            py39hca03da5_0  
pysocks                   1.7.1            py39hca03da5_0  
python                    3.9.21               hb885b13_1  
python-dateutil           2.9.0post0       py39hca03da5_2  
python-tzdata             2023.3             pyhd3eb1b0_0  
pytz                      2024.1           py39hca03da5_0  
pywavelets                1.5.0            py39hbda83bc_0  
pyyaml                    6.0.2            py39h80987f9_0  
readline                  8.2                  h1a28f6b_0  
requests                  2.32.3           py39hca03da5_1  
scipy                     1.13.1           py39hd336fd7_1  
seaborn                   0.13.2               hd8ed1ab_3    conda-forge
seaborn-base              0.13.2             pyhd8ed1ab_3    conda-forge
setuptools                75.8.0           py39hca03da5_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.45.3               h80987f9_0  
stack_data                0.6.3              pyhd8ed1ab_1    conda-forge
statsmodels               0.14.4           py39h80987f9_0  
tbb                       2021.8.0             h48ca7d4_0  
tk                        8.6.14               h6ba3021_0  
tqdm                      4.67.1           py39h33ce5c2_0  
traitlets                 5.14.3             pyhd8ed1ab_1    conda-forge
typeguard                 4.2.1            py39hca03da5_0  
typing-extensions         4.12.2           py39hca03da5_0  
typing_extensions         4.12.2           py39hca03da5_0  
tzdata                    2025a                h04d1e81_0  
unicodedata2              15.1.0           py39h80987f9_1  
urllib3                   2.3.0            py39hca03da5_0  
visions                   0.7.6            py39hca03da5_0  
wcwidth                   0.2.13             pyhd8ed1ab_1    conda-forge
wheel                     0.45.1           py39hca03da5_0  
wordcloud                 1.9.4            py39h80987f9_0  
xz                        5.6.4                h80987f9_1  
yaml                      0.2.5                h1a28f6b_0  
ydata-profiling           4.12.2                   pypi_0    pypi
zipp                      3.21.0           py39hca03da5_0  
zlib                      1.2.13               h18a0788_1  
zstd                      1.5.6                hfb09047_0

OS

Mac0S 13.5.2

Checklist

  • There is not yet another bug report for this issue in the issue tracker
  • The problem is reproducible from this bug report. This guide can help to craft a minimal bug report.
  • The issue has not been resolved by the entries listed under Common Issues.

Source: Data-Centric-AI-Community/fg-data-profiling