-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team memberOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string
Description
Pandas version checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
With Emojis
import pandas as pd
pd.set_option('display.max_rows', 1000)
pd.set_option('display.max_columns', 1000)
pd.set_option('display.width', 1000)
example = {'normal_col' : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'text_col' : ['hello world'] * 10,
'emoji_col_A' : ['🟩 hello world'] * 10,
'emoji_col_B' : ['🟥 hello world'] * 10,
'emoji_col_C' : ['🟧 hello world'] * 10,
'emoji_col_D' : ['🟨 hello world'] * 10}
df = pd.DataFrame(example)
print(df)
normal_col text_col emoji_col_A emoji_col_B emoji_col_C emoji_col_D
0 1 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
1 2 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
2 3 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
3 4 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
4 5 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
5 6 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
6 7 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
7 8 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
8 9 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
9 10 hello world 🟩 hello world 🟥 hello world 🟧 hello world 🟨 hello world
Without Emojis
import pandas as pd
pd.set_option('display.max_rows', 1000)
pd.set_option('display.max_columns', 1000)
pd.set_option('display.width', 1000)
example = {'normal_col' : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'text_col' : ['hello world'] * 10,
'emoji_col_A' : ['hello world'] * 10,
'emoji_col_B' : ['hello world'] * 10,
'emoji_col_C' : ['hello world'] * 10,
'emoji_col_D' : ['hello world'] * 10}
df = pd.DataFrame(example)
print(df)
normal_col text_col emoji_col_A emoji_col_B emoji_col_C emoji_col_D
0 1 hello world hello world hello world hello world hello world
1 2 hello world hello world hello world hello world hello world
2 3 hello world hello world hello world hello world hello world
3 4 hello world hello world hello world hello world hello world
4 5 hello world hello world hello world hello world hello world
5 6 hello world hello world hello world hello world hello world
6 7 hello world hello world hello world hello world hello world
7 8 hello world hello world hello world hello world hello world
8 9 hello world hello world hello world hello world hello world
9 10 hello world hello world hello world hello world hello world
Issue Description
Dataframe with emojis has MISALIGNED header text when printed.
Expected Behavior
Dataframe with emojis has ALIGNED header text when printed.
Installed Versions
INSTALLED VERSIONS
------------------
commit : 0f437949513225922d851e9581723d82120684a6
python : 3.8.8.final.0
python-bits : 64
OS : Darwin
OS-release : 23.4.0
Version : Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:31 PST 2024; root:xnu-10063.101.15~2/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8
pandas : 2.0.3
numpy : 1.22.4
pytz : 2022.7
dateutil : 2.8.2
setuptools : 52.0.0.post20210125
pip : 21.0.1
Cython : 0.29.23
pytest : 6.2.3
hypothesis : None
sphinx : 4.0.1
blosc : None
feather : None
xlsxwriter : 1.3.8
lxml.etree : 4.9.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.22.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.2
brotli :
fastparquet : None
fsspec : 2023.1.0
gcsfs : None
matplotlib : 3.3.4
numba : 0.53.1
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : 11.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.6.2
snappy : None
sqlalchemy : 1.4.7
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : 1.9.0
pyqt5 : None
Metadata
Metadata
Assignees
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team memberOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string