Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: to_excel() cuts off list of values when creating Excel file #58849

Closed
3 tasks done
josemariagarcia95 opened this issue May 28, 2024 · 4 comments
Closed
3 tasks done
Labels
Bug IO Excel read_excel, to_excel Needs Info Clarification about behavior needed to assess issue

Comments

@josemariagarcia95
Copy link

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

a = [-0.004518906585872173, -0.004478906746953726, -0.004878906533122063, -0.005398906767368317, -0.005588906817138195, -0.0051789069548249245, -0.004498906899243593, -0.003698906861245632, -0.0029789067339152098, -0.002688906854018569, -0.0024089068174362183, -0.0017389067215844989, -0.0008989067864604294, -0.0004789067606907338, -0.00043890674714930356, -1.890675957838539e-05, -1.890675957838539e-05, -0.0006889067590236664, -0.0012089067604392767, -0.0018789067398756742, -0.002058906713500619, -0.00273890676908195, -0.004358906764537096, -0.002638906706124544, -0.00025890677352435887, -0.0022389066871255636, -0.0024189066607505083, 0.002521093236282468, 0.005981093272566795, 0.005101093091070652, 0.0032310932874679565, 0.002561093308031559, 0.0015310932649299502, 0.0006310932221822441, 0.0034510933328419924, 0.006621093023568392, 0.004561093170195818, 0.0009310932364314795, 0.0010410932591184974, 0.0029210932552814484, 0.0025310933124274015, 0.0017410932341590524, 0.003841093275696039, 0.005901093129068613, 0.006051093339920044, 0.007461093366146088, 0.009891092777252197, 0.00959109328687191, 0.007211093325167894, 0.007781093008816242, 0.01109109353274107, 0.011471093632280827, 0.008611093275249004, 0.00681109307333827, 0.006511093117296696, 0.005071093328297138, 0.0031810931395739317, 0.0027510931249707937, 0.0015210931887850165, -0.0015189067926257849, -0.0029889068100601435, -0.0014989067567512393, 3.109324097749777e-05, -0.0005389067810028791, -0.0018289067083969712, -0.0019889066461473703, -0.001888906816020608, -0.0024589067324995995, -0.0021789066959172487, -0.0012089067604392767, -0.0018089067889377475, -0.0024989068042486906, -0.0013189067831262946, -0.0008089067414402962, -0.002758906688541174, -0.005638906732201576, -0.007608906831592321, -0.008078906685113907, -0.007858906872570515, -0.007538906764239073, -0.0068589067086577415, -0.00627890694886446, -0.00651890691369772, -0.006238906644284725, -0.004568906966596842, -0.002818906679749489, -0.0015189067926257849, -0.00036890676710754633, 0.000311093230266124, 0.00042109325295314193, 0.0009410932543687522, 0.002351093338802457, 0.002461093245074153, 0.00034109322587028146, -0.0019289067713543773, -0.0036489067133516073, -0.0043189069256186485, -0.003248906694352627, -0.0023489068262279034, -0.0023489068262279034, -0.0023389067500829697, -0.0023089067544788122, -0.001678906730376184, -0.0002689067623578012, 0.0011310932459309697, 0.0023810933344066143, 0.00336109334602952, 0.0033310933504253626, 0.0023210933431982994, 0.001231093192473054, -0.00021890675998292863, -0.0018989067757502198, -0.002328906673938036, -0.0022289068438112736, -0.002748906845226884, -0.003908906597644091, -0.006138906814157963, -0.008458906784653664, -0.009408907033503056, -0.009288907051086426, -0.008368906565010548, -0.006698906887322664, -0.0054589067585766315, -0.005058906972408295, -0.003698906861245632, -0.0006589067634195089, 0.0014510932378470898, 0.001711093238554895, 0.0020110933110117912, 0.0015710932202637196, -0.0007889067637734115, -0.0024189066607505083, -0.0019689067266881466, -0.0022389066871255636, -0.004238906782120466, -0.005308906547725201, -0.004798906855285168, -0.005308906547725201, -0.0064889066852629185, -0.006068906746804714, -0.0046589067205786705, -0.0029289068188518286, -0.0015389067120850086, -0.0001589067542226985, 0.0022810932714492083, 0.003931093029677868, 0.005091093014925718, 0.007461093366146088, 0.009111093357205391, 0.008911093696951866, 0.007621093187481165, 0.00703109335154295, 0.00780109316110611, 0.007791093084961176, 0.0076010930351912975, 0.008151093497872353, 0.007421093061566353, 0.006191093008965254, 0.006191093008965254, 0.006831093225628138, 0.007721093017607927, 0.008831093087792397, 0.010201092809438705, 0.01126109343022108, 0.010531092993915081, 0.009041093289852142, 0.008491093292832375, 0.007871093228459358, 0.00669109309092164, 0.005911093205213547, 0.005011093337088823, 0.002991093322634697, 0.0005910932668484747, -0.0008789067505858839, -0.0014989067567512393, -0.002318906830623746, -0.003658906789496541, -0.005028906743973494, -0.00627890694886446, -0.007308906875550747, -0.007258906960487366, -0.006088906899094582, -0.004988906905055046, -0.004588906653225422, -0.004628906957805157, -0.004448906984180212, -0.0042489068582654, -0.004188906867057085, -0.003978906664997339, -0.00414890656247735, -0.004328906536102295, -0.004568906966596842, -0.005388906691223383, -0.0057189068756997585, -0.005898906849324703, -0.006268906872719526, -0.005508906673640013, -0.004188906867057085, -0.0033589068334549665, -0.0028789066709578037, -0.002378906821832061, -0.001568906707689166, -0.00037890675594098866, 0.0010510932188481092, 0.001761093270033598, 0.0014010932063683867, 0.0006210932624526322, -0.0002889067691285163, -0.0006789067410863936, -0.0008389067370444536, -0.0015389067120850086, -0.0020789068657904863, -0.0023989067412912846, -0.002628906862810254, -0.0024489066563546658, -0.002528906799852848, -0.0025189067237079144, -0.0019489068072289228, -0.001298906747251749, -0.0005789067363366485, -0.0004089067515451461, -0.0007489067502319813, -0.000548906740732491, -0.0004889067495241761, -0.0010589067824184895, -0.001308906706981361, -0.001348906778730452, -0.0021889067720621824, -0.0038489068392664194, -0.005588906817138195, -0.006888906937092543, -0.007588906679302454, -0.007668906822800636, -0.007228906732052565, -0.006758906878530979, -0.0065389066003263, -0.0064889066852629185, -0.006378906778991222, -0.005488906987011433, -0.0041189067997038364, -0.002758906688541174, -0.0011289067333564162, -0.00012890675861854106, -0.0002689067623578012, -0.0007989067817106843, -0.0015289067523553967, -0.0016389067750424147, -0.0010989067377522588, -0.000708906736690551, -0.00016890675760805607, -0.0006889067590236664, -0.002478906651958823, -0.003658906789496541, -0.0037489067763090134, -0.002528906799852848, -0.0008389067370444536, 0.000391093228245154, 0.0016410932876169682, 0.002251093275845051, 0.0018910932121798396, 0.0020510931499302387, 0.0036010933108627796, 0.0058310930617153645, 0.007371093146502972, 0.008421093225479126, 0.009611093439161777, 0.009861093014478683, 0.009721092879772186, 0.011161093600094318, 0.013461093418300152, 0.014711093157529831, 0.01454109326004982, 0.0135310934856534, 0.012531093321740627, 0.012291093356907368, 0.012581093236804008, 0.013131093233823776, 0.013681093230843544, 0.012651093304157257, 0.010821092873811722, 0.009841092862188816, 0.009311093017458916, 0.00894109345972538, 0.008081093430519104, 0.006831093225628138, 0.005441093351691961, 0.0033510932698845863, 0.0009910932276397943, -0.0011489067692309618, -0.003018906805664301, -0.003908906597644091, -0.0037989066913723946, -0.004138906951993704, -0.0051789069548249245, -0.007218906655907631, -0.009948906488716602, -0.010998906567692757, -0.010308906435966492, -0.008808907121419907, -0.007468906696885824, -0.00801890715956688, -0.00907890684902668, -0.009228906594216824, -0.00948890671133995, -0.009838907048106194, -0.010118906386196613, -0.010778906755149364, -0.011298906989395618, -0.010948906652629375, -0.009748906828463078, -0.008518906310200691, -0.007638906594365835, -0.00704890675842762, -0.006718906573951244, -0.006088906899094582, -0.005148906726390123, -0.004578906577080488, -0.003958906978368759, -0.0029989066533744335, -0.0020889067091047764, -0.001078906818293035, -0.0001589067542226985, -0.0003289067535661161, -0.0015989067032933235, -0.0022789067588746548, -0.0019689067266881466, -0.001348906778730452, -0.00010890675912378356, 0.0007710932404734194, 0.0007010932313278317, 0.0011110932100564241, 0.002191093284636736, 0.00337109318934381, 0.00425109313800931, 0.004201093222945929, 0.003271093126386404, 0.00209109322167933, 0.001321093295700848, 0.0010810932144522667, 0.0009310932364314795, 0.00033109323703683913, -0.0006389067857526243, -0.002058906713500619, -0.00361890671774745, -0.004288906697183847, -0.004378906916826963, -0.004528906662017107, -0.004608906805515289, -0.00436890684068203, -0.0038389067631214857, -0.0033789067529141903, -0.0029489067383110523, -0.0025089066475629807, -0.002038906794041395, -0.001728906761854887, -0.0016389067750424147, -0.0012889067875221372, -0.0007489067502319813, -0.00031890676473267376, 0.00015109323430806398, -0.0006389067857526243, -0.0027289066929370165, -0.002258906839415431, -0.0009289067820645869, -0.004928906913846731, -0.010918906889855862, -0.01199890673160553, -0.009468906559050083, -0.005928906612098217, -0.0016089067794382572, 0.0009110932587645948, -0.00016890675760805607, -0.0030089067295193672, -0.004468906670808792, -0.0032589067704975605, -0.0008789067505858839, 0.0018410932971164584, 0.005591093096882105, 0.009901093319058418, 0.012841093353927135, 0.013341093435883522, 0.013221093453466892, 0.013421093113720417, 0.013111093081533909, 0.013911093585193157, 0.01616109348833561, 0.016911093145608902, 0.01478109322488308, 0.012061093002557755, 0.01162109337747097, 0.012531093321740627, 0.012721093371510506, 0.012401092797517776, 0.011641093529760838, 0.009851093403995037, 0.00833109300583601, 0.0092210927978158, 0.011031093075871468, 0.01126109343022108, 0.010921093635261059, 0.010231093503534794, 0.00793109368532896, 0.004641093313694, 0.0013410932151600718, -0.0013189067831262946, -0.003188906703144312, -0.005388906691223383, -0.007968906313180923, -0.010558906942605972, -0.013558906503021717, -0.015348906628787518, -0.014728906564414501, -0.012858906760811806, -0.010268907062709332, -0.00842890702188015, -0.008808907121419907, -0.010488906875252724, -0.011738906614482403, -0.011088906787335873, -0.008878907188773155, -0.006758906878530979, -0.005868906620889902, -0.006378906778991222, -0.007588906679302454, -0.009098907001316547, -0.010508907027542591, -0.010708906687796116, -0.009328906424343586, -0.007528906688094139, -0.006478906609117985, -0.005918906535953283, -0.0052589066326618195, -0.004218906629830599, -0.0023989067412912846, -0.00038890677387826145, 0.001061093294993043, 0.0015810932964086533, 0.001441093278117478, 0.002181093208491802, 0.003321093274280429, 0.0037710932083427906, 0.003701093140989542, 0.0032310932874679565, 0.0029210932552814484, 0.0030210933182388544, 0.0035210931673645973, 0.003951093181967735, 0.0036710931453853846, 0.0034010931849479675, 0.0034610931761562824, 0.0029110931791365147, 0.0017210931982845068, 0.0005110932397656143, -0.0007389067322947085, -0.0014189067296683788, -0.0009189067641273141, 0.000391093228245154, 0.0013910932466387749, 0.0007910932181403041, -0.0011689068051055074, -0.003268906846642494, -0.004378906916826963, -0.003828906686976552, -0.0028689068276435137, -0.002698906697332859, -0.0026689067017287016, -0.002818906679749489, -0.0033689066767692566, -0.0043189069256186485, -0.006048906594514847, -0.007318906951695681, -0.007298906799405813, -0.006378906778991222, -0.004978906828910112, -0.00414890656247735, -0.0044889068230986595, -0.005438906606286764, -0.005658906884491444, -0.004558906890451908, -0.0029789067339152098, -0.0018589067040011287, -0.0012389067560434341, -0.0008889067685231566, -0.0006589067634195089, -0.0005289067630656064, -0.0009689067373983562, -0.0014889067970216274, -0.0014689067611470819, -0.0010489067062735558, -0.00019890675321221352, 0.00042109325295314193, 0.0004610932373907417, 0.0007610932225361466, 0.0016710932832211256, 0.003471093252301216, 0.006011093035340309, 0.00817109365016222, 0.009631093591451645, 0.010701092891395092, 0.011881093494594097, 0.013151093386113644, 0.013881092891097069, 0.014501092955470085, 0.014891093596816063, 0.014161093160510063, 0.012771093286573887, 0.011171093210577965, 0.009311093017458916, 0.007831092923879623, 0.006961093284189701, 0.006591093260794878, 0.0066310930997133255, 0.006701093167066574, 0.00703109335154295, 0.007251093164086342, 0.0067210933193564415, 0.006101093254983425, 0.0054910932667553425, 0.004861093126237392, 0.0045410930179059505, 0.003761093132197857, 0.0019510932033881545, -0.0003489067603368312, -0.002698906697332859, -0.0047789067029953, -0.006548906676471233, -0.00830890703946352, -0.009468906559050083, -0.010188906453549862, -0.011208906769752502, -0.011528906412422657, -0.01078890636563301, -0.00997890718281269, -0.009548907168209553, -0.009788907133042812, -0.010108906775712967, -0.009228906594216824, -0.007878907024860382, -0.0073789069429039955, -0.0070289066061377525, -0.006878906860947609, -0.00755890691652894, -0.008388906717300415, -0.00895890686661005, -0.009148906916379929, -0.00919890683144331, -0.009378906339406967, -0.008638907223939896, -0.0073789069429039955, -0.0070289066061377525, -0.006898906547576189, -0.006098906975239515, -0.004468906670808792, -0.0026089067105203867, -0.0011689068051055074, 0.0003210932482033968, 0.0011110932100564241, 0.0011510932818055153, 0.0019610931631177664, 0.0031910932157188654, 0.004021093249320984, 0.00425109313800931, 0.003941093105822802, 0.0035510931629687548, 0.003121093148365617, 0.003051093313843012, 0.0031110933050513268, 0.0024810931645333767, 0.0014810932334512472, 0.0004610932373907417, 0.0001710932410787791, 0.00011109324259450659, -0.000818906759377569, -0.0008589067729189992, -0.00010890675912378356, 0.0001310932420892641, 0.0006110932445153594, 0.0005010932218283415, 6.109324021963403e-05, -0.00021890675998292863, -0.0016989067662507296, -0.0016689067706465721, 0.0007310932269319892, 0.0008910932228900492, -0.0021889067720621824, -0.0055189067497849464, -0.006888906937092543, -0.007098906673491001, -0.006838906556367874, -0.0046589067205786705, -0.0019689067266881466, -0.0016489067347720265, -0.003228906774893403, -0.004328906536102295, -0.004538906738162041, -0.004538906738162041, -0.002378906821832061, 0.0023910931777209044, 0.006331093143671751, 0.007881092838943005, 0.008081093430519104, 0.008421093225479126, 0.009011093527078629, 0.008911093696951866, 0.00930109340697527, 0.010011093690991402, 0.009081093594431877, 0.0074310931377112865, 0.006731093395501375, 0.007841093465685844, 0.009381093084812164, 0.009311093017458916, 0.008891093544661999, 0.008891093544661999, 0.008771093562245369, 0.009191093035042286, 0.010101092979311943, 0.0106810936704278, 0.010751092806458473, 0.010821092873811722, 0.011021093465387821, 0.010201092809438705, 0.007941093295812607, 0.005711093079298735, 0.003801093203946948, 0.0010410932591184974, -0.0022789067588746548, -0.005438906606286764, -0.007998907007277012, -0.00931890681385994, -0.009458906948566437, -0.008568907156586647, -0.007408906705677509, -0.007228906732052565, -0.007338906638324261, -0.007238906808197498, -0.007268906570971012, -0.006798906717449427, -0.005558906588703394, -0.0042289067059755325, -0.003778906771913171, -0.0043989066034555435, -0.005318906623870134, -0.006248906720429659, -0.007398906629532576, -0.00842890702188015, -0.008798906579613686, -0.008488906547427177, -0.007758906576782465, -0.007138906978070736, -0.006248906720429659, -0.004788906779140234, -0.0035789066459983587, -0.0023989067412912846, -0.0014489067252725363, -0.0011589067289605737, -0.0009689067373983562, -0.0007189067546278238, -0.00011890676250914112, 9.109324309974909e-05, -0.0010389067465439439, -0.002528906799852848, -0.003698906861245632, -0.003998906817287207, -0.0032989068422466516, -0.0026689067017287016, -0.002048906870186329, -0.0017989067127928138, -0.0021889067720621824, -0.0019289067713543773, -0.0014289068058133125, -0.0007789067458361387, 0.00024109323567245156, 0.0005910932668484747, 0.0012110932730138302, 0.001991093158721924, 0.001761093270033598, 0.0015410932246595621, 0.0010910932905972004, 6.109324021963403e-05, -0.0006189067498780787, -0.0011189067736268044, -0.0018689067801460624, -0.002638906706124544, -0.0028789066709578037, -0.002648906782269478, -0.0028489066753536463, -0.0030389067251235247, -0.002968906657770276, -0.0037289068568497896, -0.004168906714767218, -0.0029789067339152098, -0.0013289067428559065, -0.00025890677352435887, -7.890676351962611e-05, -0.0007689067861065269, -0.0017389067215844989, -0.0019689067266881466, -0.0012889067875221372, -0.0007389067322947085, -0.0004589067539200187, -0.0007489067502319813, -0.001678906730376184, -0.0021489067003130913, -0.002488906728103757, -0.0027689067646861076, -0.0022989066783338785, -0.0013689068146049976, 1.1093239663750865e-05, 0.001321093295700848, 0.002181093208491802, 0.00261109322309494, 0.0028110933490097523, 0.003571093315258622, 0.004901093430817127, 0.006271093152463436, 0.0071510933339595795, 0.00780109316110611, 0.00829109363257885, 0.008201093412935734, 0.00841109361499548, 0.008761093020439148, 0.008871093392372131, 0.00935109332203865, 0.009821093641221523, 0.010231093503534794, 0.010791093111038208, 0.010531092993915081, 0.009551092982292175, 0.00910109281539917, 0.00894109345972538, 0.008991093374788761, 0.009781093336641788, 0.010011093690991402, 0.00910109281539917, 0.007881092838943005, 0.0062910933047533035, 0.004491093102842569, 0.0025810932274907827, 0.0005410932353697717, -0.0008989067864604294, -0.0022389066871255636, -0.0042489068582654, -0.005698906723409891, -0.006618906743824482, -0.008088906295597553, -0.009278906509280205, -0.009748906828463078, -0.009808906354010105, -0.009028906933963299, -0.007838906720280647, -0.00767890689894557, -0.00810890644788742, -0.007928906939923763, -0.00789890717715025, -0.00822890643030405, -0.008218906819820404, -0.00789890717715025, -0.00704890675842762, -0.006338906940072775, -0.006628906819969416, -0.007058906834572554, -0.006998906843364239, -0.006498906761407852, -0.005658906884491444, -0.004688906949013472, -0.003658906789496541, -0.003338906681165099, -0.0033589068334549665, -0.002588906791061163, -0.0018189067486673594, -0.0012789067113772035, -0.0006989067769609392, -0.000708906736690551, -0.0007289067725650966, -0.00044890676508657634, -0.0008389067370444536, -0.001358906738460064, -0.0016489067347720265, -0.0022989066783338785, -0.0026689067017287016, -0.002808906836435199, -0.002818906679749489, -0.0021389068569988012, -0.0015789067838340998, -0.0013289067428559065, -0.0009189067641273141, -0.000548906740732491, -3.89067608921323e-05, 0.0005510932533070445, 0.0008210932137444615, 0.0007110932492651045, 0.0007010932313278317, 0.00101109326351434, 0.0010310931829735637, 0.0003610932326409966, -0.0005589067586697638, -0.00113890680950135, -0.001888906816020608, -0.0025589067954570055, -0.0019389067310839891, -0.001028906786814332, -0.0014189067296683788, -0.002588906791061163, -0.003338906681165099, -0.003068906720727682, -0.0020889067091047764, -0.0011289067333564162, 0.00016109323769342154, 0.0019710932392627, 0.0027010932099074125, 0.0018610932165756822, 0.0009310932364314795, 0.0009310932364314795, 0.0014710932737216353, 0.0019810933154076338, 0.0032310932874679565, 0.0046310932375490665, 0.004161093384027481, 0.0028210931923240423, 0.003001093165948987, 0.004221093375235796, 0.00488109327852726, 0.0051510934717953205, 0.005521093029528856, 0.005471093114465475, 0.00488109327852726, 0.005221093073487282, 0.0068910932168364525, 0.008161093108355999, 0.008161093108355999, 0.007461093366146088, 0.006961093284189701, 0.006751093082129955, 0.006481093354523182, 0.006861093454062939, 0.008111093193292618, 0.009021093137562275, 0.0092210927978158, 0.009371093474328518, 0.009051092900335789, 0.007401093374937773, 0.005421093199402094, 0.005431093275547028, 0.006501093041151762, 0.005621093325316906, 0.004021093249320984, 0.0033310933504253626, 0.002191093284636736, 0.0007010932313278317, -0.00029890675796195865, -0.0011989068007096648, -0.0026689067017287016, -0.004638906568288803, -0.00615890696644783, -0.0064889066852629185, -0.006458906922489405, -0.007528906688094139, -0.008738907054066658, -0.008998907171189785, -0.009448906406760216, -0.01021890714764595, -0.010408907197415829, -0.010388907045125961, -0.010418906807899475, -0.009808906354010105, -0.008798906579613686, -0.007968906313180923, -0.007268906570971012, -0.007308906875550747, -0.007788906805217266, -0.007338906638324261, -0.006428906694054604, -0.005358906928449869, -0.004188906867057085, -0.003908906597644091, -0.0037489067763090134, -0.003248906694352627, -0.0027889066841453314, -0.0019089067354798317, -0.0012289067963138223, -0.000818906759377569, 0.00010109323920914903, 0.0010910932905972004, 0.0015210931887850165, 0.0018410932971164584, 0.0023110932670533657, 0.0023310931865125895, 0.002401093253865838, 0.0026610931381583214, 0.0021110931411385536, 0.0015910932561382651, 0.0016210932517424226, 0.0013110932195559144, 0.0008710932452231646, 0.0009210932184942067, 0.0014210932422429323, 0.0016810932429507375, 0.001221093232743442, 0.0008310932316817343, 0.0007310932269319892, 0.0005010932218283415, 0.000391093228245154, 0.0005110932397656143, 0.00041109323501586914, -0.00037890675594098866, -0.0011989068007096648, -0.0017989067127928138, -0.002648906782269478, -0.0032589067704975605, -0.003348906757310033, -0.0032589067704975605, -0.0037989066913723946, -0.004758906550705433, -0.004708906635642052, -0.0042489068582654, -0.0040289065800607204, -0.003458906663581729, -0.0030089067295193672, -0.002638906706124544, -0.0020289067178964615, -0.0017689067171886563, -0.00177890679333359, -0.001348906778730452, -0.0008489067549817264, -0.00044890676508657634, 0.00029109325259923935, 0.0007510932628065348, 0.0008810932631604373, 0.0009710932499729097, 0.0006810932536609471, 0.0007010932313278317, 0.0012610931880772114, 0.001661093207076192, 0.0017510931938886642, 0.0016710932832211256, 0.0018710932927206159, 0.00273109320551157, 0.003851093351840973, 0.0047210934571921825, 0.005011093337088823, 0.0048010931350290775, 0.005021093413233757, 0.005931093357503414, 0.006661093328148127, 0.007081093266606331, 0.007501093205064535, 0.007591093424707651, 0.00703109335154295, 0.006421093363314867, 0.006541093345731497, 0.006521093193441629, 0.006001093424856663, 0.0061810933984816074, 0.006581093184649944, 0.006731093395501375, 0.006951093208044767, 0.006381093058735132, 0.005161093082278967, 0.004151093307882547, 0.00349109317176044, 0.0029810932464897633, 0.0022210932802408934, 0.0013510932913050056, 0.0005610932130366564, -0.00020890675659757107, -0.0007289067725650966, -0.001728906761854887, -0.003338906681165099, -0.0040289065800607204, -0.004298906773328781, -0.004648906644433737, -0.004358906764537096, -0.0043989066034555435, -0.005078906659036875, -0.005438906606286764, -0.005658906884491444, -0.005788906943053007, -0.005678906571120024, -0.005708906799554825, -0.005908906925469637, -0.0061489068903028965, -0.006068906746804714, -0.0055189067497849464, -0.005468906834721565, -0.005808906629681587, -0.005488906987011433, -0.005038906820118427, -0.0048289066180586815, -0.004548906814306974, -0.004348906688392162, -0.004218906629830599, -0.004218906629830599, -0.004378906916826963, -0.004408906679600477, -0.003958906978368759, -0.00360890687443316, -0.003768906695768237, -0.0035789066459983587, -0.003118906868621707, -0.00285890675149858, -0.0024989068042486906, -0.002368906745687127, -0.0024189066607505083, -0.0022989066783338785, -0.0021389068569988012, -0.001358906738460064, -0.00011890676250914112, 0.0006310932221822441, 0.0012910931836813688, 0.002071093302220106, 0.002511093160137534, 0.002881093183532357, 0.0031710932962596416, 0.0033510932698845863, 0.003951093181967735, 0.00425109313800931, 0.003761093132197857, 0.003201093291863799, 0.0024110933300107718, 0.001601093215867877, 0.0013410932151600718, 0.0009410932543687522, 0.0006510932580567896, 0.0008410932496190071, 0.0008510932675562799, 0.0009210932184942067, 0.0010910932905972004, 0.0005710932309739292, -2.8906759325764142e-05, -0.00011890676250914112, 0.00011109324259450659, 0.0005210932577028871, 0.0003810932394117117, -0.00011890676250914112, -0.0005789067363366485, -0.0011289067333564162, -0.0011589067289605737, -0.0009989067912101746, -0.0015489067882299423, -0.0026089067105203867, -0.0028289067558944225, -0.002058906713500619, -0.0015989067032933235, -0.0010489067062735558, -0.00010890675912378356, 0.00023109324683900923, 0.00037109325057826936, 0.0009410932543687522, 0.0015810932964086533, 0.002071093302220106, 0.0022210932802408934, 0.0026810932904481888, 0.0035610932391136885, 0.004081093240529299, 0.004291093442589045, 0.004211093299090862, 0.004191093146800995, 0.004471093416213989, 0.004841093439608812, 0.005781093146651983, 0.00691109336912632, 0.006961093284189701, 0.006751093082129955, 0.006871093064546585, 0.006781093310564756, 0.007181093096733093, 0.007621093187481165, 0.007421093061566353, 0.007271093316376209, 0.006661093328148127, 0.005521093029528856, 0.004851093050092459, 0.003971093334257603, 0.0028410933446139097, 0.0022310931235551834, 0.0014710932737216353, 0.00028109323466196656, -0.001028906786814332, -0.002648906782269478, -0.004238906782120466, -0.004638906568288803, -0.003888906678184867, -0.0039489069022238255, -0.005538906902074814, -0.007138906978070736, -0.00801890715956688, -0.00834890641272068, -0.008038906380534172, -0.007348906714469194, -0.006758906878530979, -0.007128906901925802, -0.008158906362950802, -0.008578906767070293, -0.008568907156586647, -0.008518906310200691, -0.008388906717300415, -0.00806890707463026, -0.007408906705677509, -0.006788906641304493, -0.006558906752616167, -0.006008906755596399, -0.005038906820118427, -0.004238906782120466, -0.003818906843662262, -0.003818906843662262, -0.0036489067133516073, -0.0036389068700373173, -0.0037889068480581045, -0.0031089067924767733, -0.0019789068028330803, -0.0012089067604392767, -0.0010089067509397864, -0.0010589067824184895, -0.0012189067201688886, -0.0012289067963138223, -0.0008489067549817264, -7.890676351962611e-05, 0.0012510932283475995, 0.0024110933300107718, 0.002831093268468976, 0.002671093214303255, 0.0026510932948440313, 0.0034410932566970587, 0.004041093401610851, 0.004141093231737614, 0.0045410930179059505, 0.005171093158423901, 0.00551109341904521, 0.005541093181818724, 0.005701093468815088, 0.005551093257963657, 0.004561093170195818, 0.0036810932215303183, 0.0032810932025313377, 0.002621093299239874, 0.0021510932128876448, 0.0022210932802408934, 0.002461093245074153, 0.0026610931381583214, 0.002401093253865838, 0.0022710931953042746, 0.002201093127951026, 0.0016910932026803493, 0.0020010932348668575, 0.0026410932186990976, 0.002561093308031559, 0.002181093208491802, 0.0010310931829735637, -0.00020890675659757107, -0.0005289067630656064, -0.0009089067461900413, -0.001398906810209155, -0.0014289068058133125, -0.0017089067259803414, -0.002478906651958823, -0.003028906648978591, -0.0029389066621661186, -0.002468906808644533, -0.0020089067984372377, -0.0015789067838340998, -0.0010589067824184895, -0.0004089067515451461, -0.0003489067603368312, -0.0007289067725650966, -0.000308906746795401, 0.000191093233297579, -0.00011890676250914112, -0.00046890677185729146, -0.0004589067539200187, -0.00016890675760805607, 8.109323971439153e-05, 8.109323971439153e-05, 0.00014109324547462165, 0.00022109324345365167, 0.0005010932218283415, 0.0013710932107642293, 0.0022810932714492083, 0.002781093353405595, 0.0032510932069271803, 0.0038310931995511055, 0.003981093410402536, 0.003431093180552125, 0.002871093340218067, 0.003041093237698078, 0.0032410931307822466, 0.0033410931937396526, 0.0037810932844877243, 0.0032410931307822466, 0.0019510932033881545, 0.0008910932228900492, -0.00019890675321221352, -0.00043890674714930356, -0.00020890675659757107, -0.0005289067630656064, -0.0011589067289605737, -0.0019089067354798317, -0.002208906691521406, -0.0023989067412912846, -0.0025089066475629807, -0.0018189067486673594, -0.0012889067875221372, -0.001308906706981361, -0.0015489067882299423, -0.0022489067632704973, -0.0025989068672060966, -0.002758906688541174, -0.0034089067485183477, -0.003988906741142273, -0.004208906553685665, -0.0038589066825807095, -0.0031089067924767733, -0.0028289067558944225, -0.0027089067734777927, -0.0025389068759977818, -0.002648906782269478, -0.002378906821832061, -0.0020289067178964615, -0.0017489067977294326, -0.001088906778022647, -0.0010989067377522588, -0.0015189067926257849, -0.0017989067127928138, -0.0020889067091047764, -0.0024189066607505083, -0.0036489067133516073, -0.004968906752765179, -0.0056289066560566425, -0.005588906817138195, -0.004438906908035278, -0.00426890654489398, -0.004858906846493483, -0.0040589068084955215, -0.003388906829059124, -0.0032989068422466516, -0.0027789068408310413, -0.002058906713500619, -0.0011589067289605737, -0.0002289067633682862, 0.0009410932543687522, 0.0021210932172834873, 0.0021610932890325785, 0.0020410933066159487, 0.002831093268468976, 0.0030710932333022356, 0.0024510931689292192, 0.0020510931499302387, 0.0022210932802408934, 0.0025910933036357164, 0.0022310931235551834, 0.0021110931411385536, 0.0025910933036357164, 0.0027010932099074125, 0.003101093228906393, 0.0037810932844877243, 0.004571093246340752, 0.005521093029528856, 0.005621093325316906, 0.005561093334108591, 0.005821093451231718, 0.005381093360483646, 0.004931093193590641, 0.005051093176007271, 0.004501093178987503, 0.003201093291863799, 0.0020210931543260813, 0.0012610931880772114, 0.0006710932357236743, 5.1093240472255275e-05, -0.00044890676508657634, -0.0007489067502319813, -0.0006989067769609392, -0.0008689067326486111, -0.0012189067201688886, -0.0010589067824184895, -0.0008089067414402962, -0.0004589067539200187, 1.0932398026852752e-06, -9.890676301438361e-05, -0.0002489067555870861, 1.1093239663750865e-05, 0.00010109323920914903, -6.890676013426855e-05, -0.00016890675760805607, -0.0005389067810028791, -0.0008989067864604294, -0.000978906755335629, -0.0013189067831262946, -0.0010689067421481013, -0.0003289067535661161, -0.00011890676250914112, 0.0009210932184942067, 0.0023210933431982994, 0.002441093325614929, 0.002521093236282468, 0.0029810932464897633, 0.003161093220114708, 0.0037810932844877243, 0.004581093322485685, 0.004441093187779188, 0.003901093266904354, 0.0032510932069271803, 0.0021110931411385536, 0.0012610931880772114, 0.0008710932452231646, -8.906759831006639e-06, -0.0011089068138971925, -0.0018989067757502198, -0.0027889066841453314, -0.00360890687443316, -0.00412890687584877, -0.004338906612247229, -0.004588906653225422, -0.0047789067029953, -0.004298906773328781, -0.004088906571269035, -0.0043989066034555435, -0.004218906629830599, -0.0042289067059755325, -0.004718906711786985, -0.0049189068377017975, -0.004668906796723604, -0.004088906571269035, -0.004278906621038914, -0.004818906541913748, -0.004428906831890345, -0.004208906553685665, -0.004198906943202019, -0.0032089068554341793, -0.0022889068350195885, -0.002258906839415431, -0.0019689067266881466, -0.0011589067289605737, -0.0008289067773148417, -0.000708906736690551, -5.89067603868898e-05, 0.000901093240827322, 0.0017210931982845068, 0.0017710932297632098, 0.0011910932371392846, 0.0009510932140983641, 0.0008410932496190071, 0.0004610932373907417, -8.906759831006639e-06, 0.00024109323567245156, 0.001761093270033598, 0.0026810932904481888, 0.002691093133762479, 0.003571093315258622, 0.004081093240529299, 0.003701093140989542, 0.0035510931629687548, 0.0032910932786762714, 0.0031310932245105505, 0.0030910931527614594, 0.0033310933504253626, 0.003861093195155263, 0.003141093300655484, 0.0014510932378470898, -0.00027890675119124353, -0.0017689067171886563, -0.002368906745687127, -0.0024389068130403757, -0.0022889068350195885, -0.0021889067720621824, -0.0031089067924767733, -0.004458906594663858, -0.004328906536102295, -0.0027189068496227264, -0.0014889067970216274, -0.0013189067831262946, -0.001348906778730452, -0.001298906747251749, -0.0010089067509397864, -1.890675957838539e-05, 0.0009710932499729097, 0.0012910931836813688, 0.0008710932452231646, 0.0002110932400682941, 0.0002110932400682941, -0.00016890675760805607, -0.0011089068138971925, -0.0010089067509397864, -0.0008989067864604294, -0.0012189067201688886, -0.000978906755335629, -0.0009089067461900413, -0.0009189067641273141, -0.0004289067583158612, 0.00041109323501586914, 0.0015810932964086533, 0.0028510931879281998, 0.003121093148365617, 0.0023110932670533657, 0.0020010932348668575, 0.002831093268468976, 0.003801093203946948, 0.0038810933474451303, 0.0034510933328419924, 0.002831093268468976, 0.0019310932839289308, 0.0013010932598263025, 0.00133109325543046, 0.0018610932165756822, 0.002081093145534396, 0.0017710932297632098, 0.0015410932246595621, 0.0013410932151600718, 0.0016410932876169682, 0.0026010931469500065, 0.003141093300655484, 0.003001093165948987, 0.002351093338802457, 0.0036610933020710945, 0.008241092786192894, 0.010171093046665192, 0.005931093357503414, -5.89067603868898e-05, -0.003888906678184867, -0.005338906776160002, -0.0041189067997038364, -3.89067608921323e-05, 0.0035210931673645973, 0.0018710932927206159, -0.004558906890451908]

print(len(a)) # 16384

b = pd.DataFrame(columns=['a'])
b.loc[0] = [a]
b.to_excel('test_b.xlsx')

c = pd.read_excel('test_b.xlsx') #a has been stored as a string, since the saved value doesn't even had a final ']'
import ast
d = ast.literal_eval(c['a'].values[0][:-2] + ']') #The last two characters are a space and a comma
print(len(d)) #1425, same result that if we copy the cell from Excel, close the list with a ']' and run len()

Issue Description

When trying to save a Dataframe which contains a column whose values are LARGE lists of values (each cell of the column hold a list of 16.384 elements) as an Excel with the to_excel() method, pandas cuts off each list of the column and save it as a 32766 character-long string. Since each list is cut off, they don't end in a square bracket. When closing them and casting them as list, they hold just 1425 elements.

Expected Behavior

The resulting Excel column should hold as much values as the original Dataframe from which it has been produced.

Installed Versions

C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages_distutils_hack_init_.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS

commit : d9cdd2e
python : 3.11.9.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : es_ES.cp1252

pandas : 2.2.2
numpy : 1.24.4
pytz : 2023.3
dateutil : 2.8.2
setuptools : 65.5.0
pip : 23.2.1
Cython : 0.29.36
pytest : None
hypothesis : None
sphinx : 6.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 5.1.0
html5lib : None
pymysql : 1.0.3
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.14.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2023.5.0
gcsfs : None
matplotlib : 3.7.1
numba : 0.57.1
numexpr : 2.8.4
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 12.0.1
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.11.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@josemariagarcia95 josemariagarcia95 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 28, 2024
@Aloqeely
Copy link
Member

Thanks for the report! In the example you provided, print(len(a)) outputs 1425 elements and print(len(d)) also outputs 1425 so nothing is being cutoff for me, could you double check if this example works or not?

@Aloqeely Aloqeely added IO Excel read_excel, to_excel Needs Info Clarification about behavior needed to assess issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 28, 2024
@chaoyihu
Copy link
Contributor

Excel has a hard limit on the size of the contents in a single cell: up to 32,767 characters:

https://github.com/pandas-dev/pandas/blob/main/pandas/io/excel/_base.py#L1360

The example provided actually works, because the length of a - converted to a string - is right at the 32,767 limit. It breaks if you add another value, in which case the user will get the warning in the code above.

In that case, Excel will cut off the list right at the limit, and it seems @josemariagarcia95 suggests that the Pandas Excel writer should gracefully truncate the written data to fit the maximum Excel cell size.

However, it seems like a pathological use case of the Excel writer, because it's not normal to try to store an entire large data series in a single Excel cell; the point of Excel is to save structured data, so the more reasonable way to use it would be to write the series as a proper Excel column, by replacing the line:

b.loc[0] = [a]

with

b['a'] = a

which works perfectly.

@asishm
Copy link
Contributor

asishm commented May 29, 2024

Can be closed as a duplicate of #56954 This is a known Excel limitation so round-tripping is not possible here. This is going to warn in pandas 3.0 (see the linked PR of that issue).

@josemariagarcia95
Copy link
Author

I wasn't aware of the Excel limitation, sorry for the disturbance and thank you all for the help!

@chaoyihu that structure comes from a DB in my company where each row holds information about a physical signal and the column "Value" contains a huge array with all the values that were read for that signal during a short period of time (I think it's a couple of seconds but it's a high-frequency signal). I was hoping to export it to Excel so non-technies colleagues could open certain snapshots I provide them with using Excel (since the alternative was to handle them really big CSV files that they would open with a regular Notebook app and that would traumatize them instantly).

Again, sorry for the misunderstanding. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Excel read_excel, to_excel Needs Info Clarification about behavior needed to assess issue
Projects
None yet
Development

No branches or pull requests

4 participants