BUG: rowspan in read_html failed · Issue #60210 · pandas-dev/pandas (original) (raw)
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
import pandas as pd
html string
s = '
Tổng giới hạn bồi thường / năm / người | \nChương trình 1 | \nChương trình 2 | \nChương trình 3 | \n
---|---|---|---|
50,000,000 | \n100,000,000 | \n200,000,000 | \n|
Tử vong do tai nạn | \n50,000,000 | \n100,000,000 | \n200,000,000 | \n
Thương tật toàn bộ vĩnh viễn/ năm | \n50,000,000 | \n100,000,000 | \n200,000,000 | \n
Thương tật bộ phận vĩnh viễn/ năm | \n50,000,000 | \n100,000,000 | \n200,000,000 | \n
Chi phí y tế điều trị thương tật do tai nạn/ năm | \n10,000,000 | \n20,000,000 | \n30,000,000 | \n
print(pd.read_html(s))
Issue Description
I have a HTML string (with rowspan attribute), here is how it look when rendering
Then I convert to dataframe by using pd.read_html
command (pandas 2.2.3), here is how it looks:
Totally wrong, the row of 50000000
, 100000000
and 200000000
should be aligned to the right.
Expected Behavior
the row of 50000000
, 100000000
and 200000000
should be aligned to the right
Installed Versions
INSTALLED VERSIONS
commit : 0691c5c
python : 3.10.9
python-bits : 64
OS : Linux
OS-release : 5.15.0-124-generic
Version : #134~20.04.1-Ubuntu SMP Tue Oct 1 15:27:33 UTC 2024
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.2.3
numpy : 1.26.4
pytz : 2022.7
dateutil : 2.8.2
pip : 24.3.1
Cython : None
sphinx : 5.0.2
IPython : 8.10.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2024.3.1
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.2
lxml.etree : 4.9.1
matplotlib : None
numba : N/A
numexpr : 2.8.4
odfpy : None
openpyxl : 3.1.3
pandas_gbq : None
psycopg2 : 2.9.9
pymysql : None
pyarrow : 16.1.0
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.10.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlsxwriter : 3.2.0
zstandard : 0.19.0
tzdata : 2024.1
qtpy : None
pyqt5 : None