pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.91k stars 18.03k forks source link

BUG: to_excel() missing values for specific dataset if lxml>=4.7.1 installed #52069

Closed fickleZZZ closed 1 year ago

fickleZZZ commented 1 year ago

Pandas version checks

Reproducible Example

# apparently xlsx line 32 doesn't get saved correctly if lxml version 4.7.1 or above is installed
import pandas as pd
list_of_dict_data = [{'CN_idx': 0, 'EN_idx': 0, 'CN': '##!!##', 'EN': '#CH1', 'Chapter': 1}, {'CN_idx': 1, 'EN_idx': 1, 'CN': '第一章 我的死亡flag竟该死的甜美.第一卷', 'EN': 'LTBE: Chapter 1: What a Darned Sweet Death Flag I Have', 'Chapter': 1}, {'CN_idx': 2, 'EN_idx': 2, 'CN': '“她叫爱丽莎,从今以后就是你的妹妹了,罗亚。”', 'EN': '“Her name is Alicia. She’ll be your little sister from now on, Roel.”', 'Chapter': 1}, {'CN_idx': 3, 'EN_idx': 3, 'CN': '富丽堂皇的客厅内,面容英俊却有些瘦弱的中年男人牵着一个银发小女孩的手,向着对面身穿名贵小礼服个子不高的黑发男孩如此介绍道。', 'EN': 'In a lavishly decorated room stood a handsome yet frail-looking middle-aged man. He held onto the hand of a silver-haired girl as he introduced her to a well-dressed, black-haired boy standing before him.', 'Chapter': 1}, {'CN_idx': 4, 'EN_idx': 4, 'CN': '男人名叫卡帝亚·阿卡特,圣梅斯特教国贵族,爵位侯爵,圣教骑士团首席巫师,阿卡特家家主,也是现在发着呆杵在他面前,不足十岁的小男孩罗亚·阿卡特的父亲。', 'EN': 'The middle-aged man was known as Carter Ascart, a marquess of the Saint Mesit Theocracy. Aside from serving as the Chief Magician of the Holy Knight Order, he was the patriarch of the illustrious Ascart House too. He was also the father of Roel Ascart, the stunned 10-year-old boy standing before him at this very instant.', 'Chapter': 1}, {'CN_idx': 5, 'EN_idx': 5, 'CN': '罗亚·阿卡特,今年九岁,侯爵家独子,五官端正俊秀,一头黑发略微显长,身高一米五,以这个年龄营养充分的贵族来说略微偏低,皮包骨头的身体显示出他日常锻炼的不足,从小接受的贵族教育让他气质沉稳,安静,以第一印象来说是属于不错的类型。', 'EN': 'Roel Ascart was the sole son of this noble house. He had dignified facial features and a head of slightly long black hair. Standing at just under 1.5 meters tall, he was considered to be on the shorter end amongst the nobles of this country. His skinny physique also revealed his lack of physical training. However, the noble education that he had undergone from a young age gave him a composed and quiet disposition, which gave most people a fairly good first impression of him.', 'Chapter': 1}, {'CN_idx': 6, 'EN_idx': 6, 'CN': '卡帝亚·阿卡特白净的脸因为儿子的丢人表现而有些发红,他抬起手想要给这臭小子来一下,可是手刚举起来又想起了自己的亡妻,纠结了片刻后只能叹了口气。', 'EN': 'Carter Ascart was clearly embarrassed by his son’s behavior. He raised his hand with an intent to give his son a whopping, but then the image of his deceased wife flashed across his mind. After a short moment of hesitation, he eventually put down his hand with a deep sigh.', 'Chapter': 1}, {'CN_idx': 7, 'EN_idx': 7, 'CN': '“咳咳,爱丽莎,看来你罗亚哥哥大概是累了,怪我之前不该让他做那么多咒术训练。”', 'EN': '“Cough cough. Alicia, it would appear that your brother Roel is exhausted. I shouldn’t have put him through so much magic training earlier.”', 'Chapter': 1}, {'CN_idx': 8, 'EN_idx': 8, 'CN': '卡帝亚侯爵一边扯下老脸给坑爹儿子圆场,一边向身边的女仆们打着手势,懂事的仆人们立即带着罗亚下去休息,而在小男孩的身后也响起了女孩勉强的声音。', 'EN': 'As Marquess Carter put down his pride to help clear up the situation for his darned son, he discreetly gestured to the maids by the side. The sharp-witted maids immediately stepped forth and brought Roel back to his room to rest.It was then that Roel finally heard the strained voice of a little girl behind him.', 'Chapter': 1}, {'CN_idx': 9, 'EN_idx': 9, 'CN': '“没,没关系,不怪父亲大人......”', 'EN': '“I-I’m alright. It’s not father’s fault…”', 'Chapter': 1}, {'CN_idx': 10, 'EN_idx': 10, 'CN': '-----------------------------------', 'EN': '…', 'Chapter': 1}, {'CN_idx': 11, 'EN_idx': 11, 'CN': '罗亚·阿卡特此时正在怀疑人生。', 'EN': 'Roel Ascart was really doubting his life at the moment.', 'Chapter': 1}, {'CN_idx': 12, 'EN_idx': 12, 'CN': '因为他穿越了,或者说他刚刚想起来前世的记忆。', 'EN': 'He realized that he was actually a transmigrator. Or to be more exact, he had just remembered the memories of his previous life.', 'Chapter': 1}, {'CN_idx': 13, 'EN_idx': 13, 'CN': '罗亚,性别男爱好女,二十岁天朝大学生,没有离奇的家世,没有千层饼一样的爱情经历,普普通通平平凡凡,如果要说有什么不同之处,那大概就是比较宅,平时喜欢看看小说追追番,还喜欢打一些宅向的游戏。', 'EN': 'Roel, a heterosexual male, had been a twenty-year-old university student from Earth. He was born to an average family, and he didn’t have any particular experiences in romance either. To summarize, he was a perfectly ordinary person. If one had to point out something that was different about him, it would be that he was practically a NEET. He liked to spend his time reading novels and playing otaku-esque games.', 'Chapter': 1}, {'CN_idx': 14, 'EN_idx': 14, 'CN': '咳咳,懂的都懂。', 'EN': 'Cough cough, you get it.', 'Chapter': 1}, {'CN_idx': 15, 'EN_idx': 15, 'CN': '刚刚在客厅瞠目结舌缓不过来的小鬼头可不只是因为突然恢复了前世记忆而硬了,他当场石化其实是吓的。', 'EN': 'He wasn’t rendered speechless earlier on just because he had remembered the memories of his previous life; rather, it was out of fright.', 'Chapter': 1}, {'CN_idx': 16, 'EN_idx': 16, 'CN': '因为在他面前被父亲护着的那个柔弱的小女孩——爱丽莎·阿卡特,在十年之后将手刃其义兄罗亚·阿卡特。', 'EN': 'Ten years later, the frail little girl whom his father was protecting earlier, Alicia Ascart, would kill her brother, Roel Ascart.', 'Chapter': 1}, {'CN_idx': 17, 'EN_idx': 17, 'CN': '骨灰都给扬了的那种。', 'EN': 'In cold blood, without a hint of mercy.', 'Chapter': 1}, {'CN_idx': 0, 'EN_idx': 0.0, 'CN': '##!!##', 'EN': '#CH2', 'Chapter': 2}, {'CN_idx': 1, 'EN_idx': 1.0, 'CN': '第二章 我觉得我得死个明白', 'EN': 'LTBE: Chapter 2: I Should At Least Die A Knowing Death', 'Chapter': 2}, {'CN_idx': 2, 'EN_idx': 2.0, 'CN': '《记录者之眼》这个名字就一股子战略味的galgame剧情其实相当复杂,可攻略角色有四位,走的是和普通galgame一样,前期一条主线,后期各角色支线的套路。', 'EN': 'Eyes of the Chronicler was a strategy-based gal game with a fairly complicated storyline. There were 4 main capture targets, and just like most gal games, it started off with a common route before diverging into the independent routes of the chosen capture target in the later stages of the game.', 'Chapter': 2}, {'CN_idx': 3, 'EN_idx': 3.0, 'CN': '虽然由于剧情内容太多、跳跃太大,给人一种填鸭式塞信息的感觉以至于游玩性很差,后期那么多支线经常bad end还没有h剧情导致玩家抓狂,但是排除掉这些以外,这个游戏还是有些可取之处的。', 'EN': 'The excessive number of events and frequent time skips in the game crammed players with an overload of information, creating a poor user experience. On top of that, the multitude of routes that led to bad ends, as well as the lack of satisfying eroticism within the game, left frustrated players dying to bang their heads against walls.', 'Chapter': 2}, {'CN_idx': 4, 'EN_idx': 4.0, 'CN': '比如它对重点角色的刻画还算过得去,角色情况的前因后果交代的也比较明白。', 'EN': 'Putting all of this aside though, there were still some strengths to the game.The illustrations of major characters were amazing, and the background and storyline of the characters were also quite detailed.', 'Chapter': 2}, {'CN_idx': 5, 'EN_idx': 5.0, 'CN': '不错,罗亚·阿卡特正是《观察者之眼》中学院主线区域的Boss!', 'EN': 'Indeed, Roel Ascart was no other than the boss of the Middle School Arc in Eyes of the Chronicler!', 'Chapter': 2}, {'CN_idx': 6, 'EN_idx': 6.0, 'CN': '这个游戏的主线基本就是以主角和他的后宫们挫败罗亚·阿卡特的种种阴谋,最终团结一心将他围殴至死而告终,战斗结束后主角就会选择自己的伴侣并开始个人分支。', 'EN': 'In that arc, the main character and his harem would unravel the schemes of Roel Ascart before uniting together to lynch him to death. At the end of the battle, the main character would choose a capture target and embark on the independent route.', 'Chapter': 2}, {'CN_idx': 7, 'EN_idx': 7.0, 'CN': '而在这个剧情中爱丽莎虽然是罗亚的义妹,但是却饱受欺压对他恨之入骨,最终决战时更是秉承着有冤报冤有仇报仇的原则,一刀剁了他的狗头。', 'EN': 'In the storyline, even though Alicia was the adopted sister of Roel, she hated Roel deeply due to the suffering she went through under his oppression. In the final battle, with the creed of ‘An eye for an eye’, she sliced off his head decisively with a single slash.', 'Chapter': 2}, {'CN_idx': 8, 'EN_idx': 8.0, 'CN': '“......”', 'EN': '“…”', 'Chapter': 2}, {'CN_idx': 9, 'EN_idx': 9.0, 'CN': '黑发的可爱小男孩坐在黑槐木的高脚椅上,认真的盯着身前的桌角看了一会,反复思考着一件事......', 'EN': 'The adorable black-haired boy sat on a high Robinia wood chair and he stared at the edge of the table in front of him earnestly, contemplating a matter seriously…', 'Chapter': 2}, {'CN_idx': 10, 'EN_idx': 10.0, 'CN': '我现在一头磕死还来不来得及换角色?', 'EN': 'Is it too late for me to change characters if I bash my head on the corner of the table right now?', 'Chapter': 2}, {'CN_idx': 11, 'EN_idx': 11.0, 'CN': '罗亚捂住脑门,小小的脸蛋皱起,简直想哇的一声哭出来。', 'EN': 'Roel touched his forehead as a slight frown slowly formed on his young face. He really felt like bawling out his eyes right now!', 'Chapter': 2}, {'CN_idx': 12, 'EN_idx': 12.0, 'CN': '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线的都行啊!', 'EN': 'Isn’t the world just screwing with me? It’s one thing for you to not transmigrate me into the position of the main character, but you even made me a villain in the common route? Can things get worse than this?', 'Chapter': 2}, {'CN_idx': 13, 'EN_idx': 13.0, 'CN': '【叮】', 'EN': '【Ding!】', 'Chapter': 2}, {'CN_idx': 14, 'EN_idx': 14.0, 'CN': '【接受宿主求助,检测宿主身体,检测完毕,建议查看兑换系统,已跳转金币购置区】', 'EN': '【The user’s call for help has been accepted. Scanning the user’s body. Scanning completed. The user is advised to check the shops. Redirecting to the Gold Coin Shop.】', 'Chapter': 2}, {'CN_idx': 15, 'EN_idx': 15.0, 'CN': '【建议宿主密切关注金币购置区血脉及体质改良物品,根据宿主身体及灵魂性质,兑换区与购置区物品将进行调整】', 'EN': '【The user is advised to keep a close eye on the items relating to bloodline and constitution enhancement. The Affection Point Exchange Shop and Gold Coin Shop are being refreshed.】', 'Chapter': 2}, {'CN_idx': 16, 'EN_idx': 16.0, 'CN': '【3,2,1......调整完毕】', 'EN': '【3, 2, 1… Refresh complete.】', 'Chapter': 2}, {'CN_idx': 17, 'EN_idx': 17.0, 'CN': '随着系统提示音,罗亚眼见着之前在他面前满满一页五光十色的光辉盾牌、双手大剑一刷全没,再次出现时清单上的东西已经变成了一页色彩暗沉,造型独特,一看就散发层层不详气息的诡异物品。', 'EN': 'As the voice sounded from the System, Roel saw rows of shining shields and two-handed swords disappear right before his eyes, replaced with a page filled with dark-colored, bizarre goods that gave off ominous vibes.', 'Chapter': 2}, {'CN_idx': 18, 'EN_idx': 18.0, 'CN': '心中一惊,罗亚逐一看了过去。', 'EN': 'Roel’s heart skipped a beat. He began looking through the list one by one.', 'Chapter': 2}, {'CN_idx': 19, 'EN_idx': 19.0, 'CN': '九头蛇之杖,拉法恩指甲书,贝肯的头骨,恐惧原石......靠,这都什么鬼东西啊,等等!青铜血脉!', 'EN': 'Nine-headed Serpent Staff, Raphaen’s Fingernail Book, Bec’s Skull, Primitive Stone of Terror… Holy shit, what the hell are all of these? Wait a moment… Bronze Bloodline!', 'Chapter': 2}, {'CN_idx': 20, 'EN_idx': 20.0, 'CN': '货单最后一件物品让罗亚激动的张大了嘴,随后赶忙聚集精神认真观看。', 'EN': 'There was one item at the very end of the list that made Roel open his mouth wide in shock. He quickly focused his attention and took a closer look at it.', 'Chapter': 2}, {'CN_idx': 21, 'EN_idx': 21.0, 'CN': '【拉法恩的血脉从者(下级青铜血脉)】', 'EN': '【Blood Servant of Raphaen (Lower Bronze Bloodline)', 'Chapter': 2}, {'CN_idx': 22, 'EN_idx': 22.0, 'CN': '【陷入疯狂的大巫师拉法恩为了延续生命创造的血脉,他惨无人道的实验杀死了上千的平民,也引起了大陆上所有正义之士的愤慨,他因此毁灭,但却创造出一种难以杀死的梦魇血脉,传说被他改造的不幸者至今仍在其坟墓旁徘徊环绕】', 'EN': 'A bloodline created by Great Warlock Raphaen to prolong his longevity after he descended into lunacy. His cruel experiments have led to the death of thousands of innocent civilians, invoking the rage of the populace on the continent. He eventually lost his life to a crusade against him. However, before his death, he managed to create a nigh indestructible bloodline of the nightmares. Rumors have it that some of the unfortunate civilians who have been experimented on by him still loiter around their graves to this day.', 'Chapter': 2}, {'CN_idx': 23, 'EN_idx': 23.0, 'CN': '【血脉效果:急速再生】', 'EN': 'Bloodline Effect: Swift Regeneration', 'Chapter': 2}, {'CN_idx': 24, 'EN_idx': 24.0, 'CN': '【副作用:精神侵蚀】', 'EN': 'Side Effect: Sanity Corrosion', 'Chapter': 2}, {'CN_idx': 25, 'EN_idx': 25.0, 'CN': '【售价:10000金币】', 'EN': 'Price: 10,000 Gold Coins】', 'Chapter': 2}, {'CN_idx': 26, 'EN_idx': 26.0, 'CN': '“精神侵蚀?这谁敢用?还有......这也太贵了吧!”', 'EN': '“Sanity Corrosion? W-who in the world would dare to use something like this? Besides… this is too expensive!”', 'Chapter': 2}, {'CN_idx': 27, 'EN_idx': 27.0, 'CN': '罗亚盯着物品说明最后一行的售价,俊秀的小脸一阵抽搐。', 'EN': 'Roel’s handsome face twitched upon seeing the description of the item.', 'Chapter': 2}, {'CN_idx': 28, 'EN_idx': 28.0, 'CN': '一万金币!这是什么概念?', 'EN': '10,000 gold coins! What did that mean?', 'Chapter': 2}, {'CN_idx': 29, 'EN_idx': 29.0, 'CN': '“我侯爵之子,一个月零花钱才十多金币!普通平民一家三口省着点用二十七八个金币能过一年了!你这一个下级青铜血脉就卖一万?还是个可能变成憨憨的残次品?”', 'EN': '“Even as the son of a marquess, I only receive 10 gold coins as pocket money every month! For an ordinary family, as long as they scrimped and saved, 28 gold coins would be roughly enough for them to last a year! How is it that your Lower Bronze Bloodline costs a whopping 10,000 gold coins? Not to mention, it’s still an inferior good that can turn a person into a fool…”', 'Chapter': 2}, {'CN_idx': 30, 'EN_idx': 30.0, 'CN': '“不管怎么说这还是太贵了,我才九岁啊,上哪弄那么多钱?”', 'EN': '“But no matter what, it’s still too expensive. I’m just a nine-year-old! Where am I to find that much money?”', 'Chapter': 2}, {'CN_idx': 31, 'EN_idx': 31.0, 'CN': '【建议宿主查看好感度兑换区,通过获得好感度兑换物品振兴家族创收,再使用赚取的钱财购买物品提升自身,宿主的强大将带领家族走向更好的前景,如此形成良性循环,才能拔除死亡flag,走向美好人生】', 'EN': '【The user is advised to take a look at the Affection Point Exchange Shop to obtain tools that would improve the Ascart House’s revenue before using the money earned to improve himself. The user’s strength will be essential in leading the Ascart House to a bright future. Only through forming such a virtuous cycle will the user be able to overcome his death flags and enjoy a fulfilling life.】', 'Chapter': 2}, {'CN_idx': 32, 'EN_idx': 32.0, 'CN': '“那,那我看看好感度兑换区吧。”', 'EN': '“I see. I’ll take a look at the Affection Point Exchange Shop then.”', 'Chapter': 2}, {'CN_idx': 33, 'EN_idx': 33.0, 'CN': '罗亚被系统一套连招说服,决定先观察一下好感度区域,但很快他的面容便复杂了起来。', 'EN': 'Roel was persuaded by the long speech made by the System, so he decided to take a look at the Affection Point Exchange System first. But soon enough, his face turned grim once again.', 'Chapter': 2}, {'CN_idx': 34, 'EN_idx': 34.0, 'CN': '【圣水池(极)】', 'EN': '【Spring of Holy Water (High)', 'Chapter': 2}, {'CN_idx': 35, 'EN_idx': 35.0, 'CN': '【绚烂的水花治愈心灵的伤痛,它会招来我们的朋友】', 'EN': 'Reinvigorating water that heals the injuries of the heart. It will summon our friends.', 'Chapter': 2}, {'CN_idx': 36, 'EN_idx': 36.0, 'CN': '【售价:250万点数】', 'EN': 'Price: 2,500,000 Affection Points】', 'Chapter': 2}, {'CN_idx': 37, 'EN_idx': 37.0, 'CN': '【启迪之灯】', 'EN': '【Light of Tuspark', 'Chapter': 2}, {'CN_idx': 38, 'EN_idx': 38.0, 'CN': '【光明照亮混沌,祂们不在这里】', 'EN': 'Light shines through the darkness, dispelling them from sight.', 'Chapter': 2}, {'CN_idx': 39, 'EN_idx': 39.0, 'CN': '【售价:30万点数/盏】', 'EN': 'Price: 300,000 Affection Points Per Light】', 'Chapter': 2}, {'CN_idx': 40, 'EN_idx': 40.0, 'CN': '......', 'EN': '…', 'Chapter': 2}, {'CN_idx': 41, 'EN_idx': 41.0, 'CN': '【光之甲的附魔间】', 'EN': '【Enchantment Workshop of the Shining Armor', 'Chapter': 2}, {'CN_idx': 42, 'EN_idx': 42.0, 'CN': '【古巴托帝国失传技术的片段,传说兵种巴托不死者铠甲装备的基础生产车间,用于初步的附魔与加固】', 'EN': 'A snapshot of the lost technology of the Gulbator Empire. It’s a basic production line of the armor of the legendary soldiers, Undying Bators. Used for primary enchantment and reinforcement.', 'Chapter': 2}, {'CN_idx': 43, 'EN_idx': 43.0, 'CN': '【售价:70万点数】', 'EN': 'Price: 700,000 Affection Points】', 'Chapter': 2}, {'CN_idx': 44, 'EN_idx': 44.0, 'CN': '“除了最后一个怎么简介都这么模糊?完全不知道是用来干什么的,而且要的点数好多!”', 'EN': '“Other than the last item, why are the descriptions of the items so vague? I have completely no idea what they are used for at all. Besides, they are all so expensive!”', 'Chapter': 2}, {'CN_idx': 45, 'EN_idx': 45.0, 'CN': '【简介语焉不详是需要根据宿主的个人情况在一定范围内进行调整,好感度易于获得,宿主不必过于慌张】', 'EN': '【The descriptions will be altered in accordance with the circumstances of the user. Affection Points are easier to earn, so the user need not worry too much about it.】', 'Chapter': 2}, {'CN_idx': 46, 'EN_idx': 45.5, 'CN': '【鉴于宿主情况紧急,系统决定赠送新人道具】', 'EN': None, 'Chapter': 2}, {'CN_idx': 47, 'EN_idx': 46.0, 'CN': '【叮】', 'EN': '【Ding!】', 'Chapter': 2}, {'CN_idx': 48, 'EN_idx': 47.0, 'CN': '【恭喜您获得:荣誉者徽章】', 'EN': '【Congratulations, you have obtained: Emblem of Glory】', 'Chapter': 2}, {'CN_idx': 49, 'EN_idx': 48.0, 'CN': '【荣誉者徽章:英雄的魅力无可阻挡,带有轻微而不易察觉的魅惑,作用强度根据佩戴者的不同而不同】', 'EN': '【Emblem of Glory: The charisma of a hero is unstoppable. A person equipped with this item will emanate a slight yet inconspicuous seductive charm. Its effects vary per person.】', 'Chapter': 2}, {'CN_idx': 50, 'EN_idx': 49.0, 'CN': '“嗯?魅惑?也就是说带上它更加利于得到好感度?”', 'EN': '“Hm? Seductive charm? In other words, if I wear it, it’ll be beneficial to me in winning the affection of others?”', 'Chapter': 2}, {'CN_idx': 51, 'EN_idx': 50.0, 'CN': '【正解,物品已发放,建议宿主尽快使用】', 'EN': '【Bingo. The item has already been given out. The user is advised to quickly equip it.】', 'Chapter': 2}, {'CN_idx': 52, 'EN_idx': 51.0, 'CN': '系统话音刚落,罗亚的手上便闪烁起点点光芒,就如往昔的夏夜中阿卡特领的萤火虫在他手掌上嬉戏之时一般,等少年回过神来时,手掌上已经出现了一枚光芒凝实而成的小小徽章。', 'EN': 'Right after the System said those words, bits of light began gleaming from Roel’s hand. It looked similar to how the fireflies of the Ascart Fiefdom would usually frolic in his hands during the past summer nights. By the time the little boy returned to his senses, the light had already formed a small emblem on his palm.', 'Chapter': 2}, {'CN_idx': 53, 'EN_idx': 52.0, 'CN': '“这就是......我改变命运的契机吗?”', 'EN': '“Is this… the key to changing my fate?”', 'Chapter': 2}, {'CN_idx': 54, 'EN_idx': 53.0, 'CN': '黑发的可爱男孩握着手中的徽章喃喃自语,系统建议立即使用这一点他很赞成,不过戴上了这徽章之后该去先刷谁的好感度呢?这个问题......', 'EN': 'The adorable black-haired boy muttered to himself as he grasped the emblem in his hand tightly. He did want to try out the effect of the emblem right away, but whose affection should he try to win over? Regarding this question…', 'Chapter': 2}, {'CN_idx': 55, 'EN_idx': 54.0, 'CN': '“还用说吗?”', 'EN': '“Is that even a question at all?”', 'Chapter': 2}, {'CN_idx': 56, 'EN_idx': 55.0, 'CN': '罗亚将银质的徽章别在胸前,脑海中闪过那银色妖精般动人的身影,脸上露出背水一战的坚毅表情。', 'EN': 'Roel pinned the silver emblem on his chest as a silver-haired silhouette flashed across his mind. A hardy expression reminiscent of a soldier fighting against all odds appeared on his face.', 'Chapter': 2}, {'CN_idx': 57, 'EN_idx': 56.0, 'CN': '“爱丽莎·阿卡特!爷来了!”', 'EN': '“Alicia Ascart, here I come!”', 'Chapter': 2}, {'CN_idx': 0.0, 'EN_idx': 0.0, 'CN': '##!!##', 'EN': '#CH4', 'Chapter': 3}, {'CN_idx': 1.0, 'EN_idx': 1.0, 'CN': '第四章 餐桌上的攻防', 'EN': 'LTBE: Chapter 4: Push and Pull on the Dining Table', 'Chapter': 3}, {'CN_idx': 2.0, 'EN_idx': 2.0, 'CN': '爷,生死一战!', 'EN': 'Time to go for an all-out fight!', 'Chapter': 3}, {'CN_idx': 3.0, 'EN_idx': 3.0, 'CN': '卡帝亚侯爵的书房内,罗亚面容坚毅的手抚着胸前的徽章,就如开战前的潘德骑士手抚长剑。', 'EN': 'In Marquess Carter’s study room, Roel touched the emblem pinned on his chest with a solemn expression on his face, reminiscent of a Pendor Knight drawing his blade prior to the start of a battle.', 'Chapter': 3}, {'CN_idx': 4.0, 'EN_idx': 4.0, 'CN': '“当然!”', 'EN': '“Of course!”', 'Chapter': 3}, {'CN_idx': 5.0, 'EN_idx': 5.0, 'CN': '“太好了......啊!”', 'EN': '“That’s great… Ah!”', 'Chapter': 3}, {'CN_idx': 6.0, 'EN_idx': 6.0, 'CN': '按剧本情绪投入演得正欢的罗亚突然一声惊叫,让安娜有些不解的眨了眨眼,然而她却不知道少年看到了怎样的一幕。', 'EN': 'Roel, who had been devoting all of his emotions into carrying out the script, suddenly yelped out loud, causing Anna to blink her eyes in confusion.', 'Chapter': 3}, {'CN_idx': 7.0, 'EN_idx': 7.0, 'CN': '在答应原谅罗亚的那一刻,少年清晰的看到安娜的头顶冒出一层绿光,随后变出了一串字。', 'EN': 'At the moment that Anna agreed to forgive Roel, the little boy saw green light rising from Anna’s head, forming a series of words.', 'Chapter': 3}, {'CN_idx': 8.0, 'EN_idx': 8.0, 'CN': '好感度+150!', 'EN': '(Affection Points +150!)', 'Chapter': 3}, {'CN_idx': 9.0, 'EN_idx': 9.0, 'CN': '我去!真的有好感度!而且好多!', 'EN': 'Holy moly! It’s really possible to earn Affection Points like this, and it’s more than I thought!', 'Chapter': 3}, {'CN_idx': 10.0, 'EN_idx': 10.0, 'CN': '罗亚内心激动的握起了拳,眼中亮起了希望。', 'EN': 'Roel clenched his fists tightly together from agitation as hope lit up in his eyes.', 'Chapter': 3}, {'CN_idx': 11.0, 'EN_idx': 11.0, 'CN': '能行!这好感度比金币好收集太多了!', 'EN': 'Hehe, I’ll be able to gather Affection Points way faster than gold coin then!', 'Chapter': 3}, {'CN_idx': 12.0, 'EN_idx': 12.0, 'CN': '实验,大成功!', 'EN': 'Experiment, success!', 'Chapter': 3}, {'CN_idx': 13.0, 'EN_idx': 13.0, 'CN': '爱丽莎,爷真来了!', 'EN': 'Alicia, I’m really coming now!', 'Chapter': 3}, {'CN_idx': 14.0, 'EN_idx': 14.0, 'CN': '------------------------------------', 'EN': '…', 'Chapter': 3}, {'CN_idx': 15.0, 'EN_idx': 15.0, 'CN': '“兄,兄长大人,午安。”', 'EN': '“L-lord Brother, a pleasant afternoon to you.”', 'Chapter': 3}, {'CN_idx': 16.0, 'EN_idx': 16.0, 'CN': '中午时分,卡帝亚侯爵出门办事,宽敞的餐厅内只剩罗亚与爱丽莎共进午餐。', 'EN': 'It was afternoon, and Marquess Carter had gone out to deal with other affairs, leaving just Roel and Alicia in the spacious dining room for lunch.', 'Chapter': 3}, {'CN_idx': 17.0, 'EN_idx': 17.0, 'CN': '银发的小女孩见到比自己稍大的义兄,想起了上午被罗亚用可怕表情盯着的样子,虽然害怕但还是强撑着礼貌地打了个招呼,而罗亚则简单的回应了一下。', 'EN': 'As soon as the silver-haired girl saw her slightly older brother, she recalled the frightening look the latter had looked at her with earlier on. She was terrified of him, but she still tried her best to buck up her courage and greet him politely, and to which, Roel replied with a simple nod.', 'Chapter': 3}, {'CN_idx': 18.0, 'EN_idx': 18.0, 'CN': '然后爱丽莎便在仆人的帮助下与罗亚在能容纳二十人的长桌前相对而坐,一边等待侍者端来食物,一边维持着有些尴尬的沉默。', 'EN': 'Following that, under the assistance of the maids, Alicia was settled right before Roel on a long dining table that could easily hold twenty people. It was in a slightly awkward silence that the two of them waited for the maids to serve the dishes.', 'Chapter': 3}, {'CN_idx': 19.0, 'EN_idx': 19.0, 'CN': '银发的少女低着头,双手紧张地握着桌下的裙子,一双赤瞳时不时地挑起望向对面的罗亚又垂下,一副忐忑不安的样子。', 'EN': 'The silver-haired girl had her head lowered as she nervously gripped the hems of her skirt beneath the table. From time to time, she would glance at Roel before swiftly averting her eyes, exposing the trepidation she felt inside.', 'Chapter': 3}, {'CN_idx': 20.0, 'EN_idx': 20.0, 'CN': '罗亚知道,爱丽莎在等他开口,说出中午启用餐厅的原因。', 'EN': 'Roel knew that Alicia was waiting for him to speak up and reveal the reason why they were having this luncheon together.', 'Chapter': 3}, {'CN_idx': 21.0, 'EN_idx': 21.0, 'CN': '不错,正常来说在阿卡特这种家族成员很少的贵族家,家主卡帝亚不在的时候,罗亚和爱丽莎这样的小孩是各自在自己房间中用餐的,一个原因是节约成本,另一个原因是这样才能衬托出家主的威严。', 'EN': 'In noble houses like the Ascart House, whenever the patriarch, Marquess Carter, was not around, children like Roel and Alicia tended to have their luncheon privately in their rooms. One reason was to cut cost, and the other one was to uphold the solemn dignity of the head of the house.', 'Chapter': 3}, {'CN_idx': 22.0, 'EN_idx': 22.0, 'CN': '不过由', 'EN': 'However, as the', 'Chapter': 3}]
df = pd.DataFrame(list_of_dict_data)

assert df.iloc[30]['CN'] == '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线的都行啊!'  # value on index 30 still correct before exporting to excel
df.to_excel('test2.xlsx')  
df_after = pd.read_excel('test2.xlsx', 'Sheet1')

if df_after.iloc[30]['CN'] == '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线':
    print('is Faulty, the 的都行啊!is missing at the end of the string')  # but not thereafter
elif df_after.iloc[30]['CN'] == '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线的都行啊!':
    print('is working as intended')

Issue Description

With the provided Reproducible Example, and with lxml>=4.7.1 installed

using to_excel(), index 30 of column CN will always be missing value on export.

this is original value (index 30 in df) '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线的都行啊!'

but this is what get saved to xlsx (row 32 in xlsx) '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线'

This works fine if I uninstall lxml or use lxml version 4.6.5 or lower

Note: I have tried reducing data as much as I could, even removing a single more line would not produce this unexpected behavior, i have also tried altering values of other supposedly irrelevant column& row, but that change would not produce this unexpected behavior. It's not exactly a sensitive data though.

Expected Behavior

The value on index 30 (or row 32 in excel) of column CN is '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线的都行啊!'

but after exporting to excel with to_excel() and reading again, the value becomes '什么鬼哦,妈的这是在搞我吧?穿越不给主角就算了,居然给反派?还他娘是个公共线反派!你给我个支线'

that is, '的都行啊!' at the end of string is missing

note that this only happen if lxml version 4.7.1 or above is installed

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.10.9.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19044 machine : AMD64 processor : AMD64 Family 23 Model 8 Stepping 2, AuthenticAMD byteorder : little LC_ALL : None LANG : None LOCALE : English_Australia.utf8 pandas : 1.5.3 numpy : 1.24.2 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 65.5.1 pip : 22.3.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.2 html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : 4.11.2 bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : None snappy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None tzdata : None
phofl commented 1 year ago

Hi thanks for your report. If you already determined that this is a problem from lxml, what can we do about it? it's probably more efficient if you report the bug there

phofl commented 1 year ago

Closing for now, please ping to reopen if the bug is in pandas and not lxml