I have the following code in Python that has a list of floats being converted to a Pandas Dataframe, but when I print the converted dataframe the values appear to be overflown (while they are looking ok when in the list - see below output).
Is my way of converting the list to dataframe causing this?
Source Code:
# Calculating t_j, 0 <= j <= N
# tj = t_min tj * dt
for N in range(number_of_periods): # number_of_periods = 500
t_j = float(t_min (small_delta_taf * N))
# print("t_", N, " = ", t_j)
periods_separators.append(t_j)
periods_separators_df = pd.DataFrame(periods_separators)
print(periods_separators)
print(periods_separators_df, sep='\n')
print("This is where main ends")
# End of main()
Output:
[1220729190.0, 1220780675.5, 1220832161.0, 1220883646.5, 1220935132.0, 1220986617.5, 1221038103.0, 1221089588.5, 1221141074.0, 1221192559.5, 1221244045.0, 1221295530.5, 1221347016.0, 1221398501.5, 1221449987.0, 1221501472.5, 1221552958.0, 1221604443.5, 1221655929.0, 1221707414.5, 1221758900.0, 1221810385.5, 1221861871.0, 1221913356.5, 1221964842.0, 1222016327.5, 1222067813.0, 1222119298.5, 1222170784.0, 1222222269.5, 1222273755.0, 1222325240.5, 1222376726.0, 1222428211.5, 1222479697.0, 1222531182.5, 1222582668.0, 1222634153.5, 1222685639.0, 1222737124.5, 1222788610.0, 1222840095.5, 1222891581.0, 1222943066.5, 1222994552.0, 1223046037.5, 1223097523.0, 1223149008.5, 1223200494.0, 1223251979.5, 1223303465.0, 1223354950.5, 1223406436.0, 1223457921.5, 1223509407.0, 1223560892.5, 1223612378.0, 1223663863.5, 1223715349.0, 1223766834.5, 1223818320.0, 1223869805.5, 1223921291.0, 1223972776.5, 1224024262.0, 1224075747.5, 1224127233.0, 1224178718.5, 1224230204.0, 1224281689.5, 1224333175.0, 1224384660.5, 1224436146.0, 1224487631.5, 1224539117.0, 1224590602.5, 1224642088.0, 1224693573.5, 1224745059.0, 1224796544.5, 1224848030.0, 1224899515.5, 1224951001.0, 1225002486.5, 1225053972.0, 1225105457.5, 1225156943.0, 1225208428.5, 1225259914.0, 1225311399.5, 1225362885.0, 1225414370.5, 1225465856.0, 1225517341.5, 1225568827.0, 1225620312.5, 1225671798.0, 1225723283.5, 1225774769.0, 1225826254.5, 1225877740.0, 1225929225.5, 1225980711.0, 1226032196.5, 1226083682.0, 1226135167.5, 1226186653.0, 1226238138.5, 1226289624.0, 1226341109.5, 1226392595.0, 1226444080.5, 1226495566.0, 1226547051.5, 1226598537.0, 1226650022.5, 1226701508.0, 1226752993.5, 1226804479.0, 1226855964.5, 1226907450.0, 1226958935.5, 1227010421.0, 1227061906.5, 1227113392.0, 1227164877.5, 1227216363.0, 1227267848.5, 1227319334.0, 1227370819.5, 1227422305.0, 1227473790.5, 1227525276.0, 1227576761.5, 1227628247.0, 1227679732.5, 1227731218.0, 1227782703.5, 1227834189.0, 1227885674.5, 1227937160.0, 1227988645.5, 1228040131.0, 1228091616.5, 1228143102.0, 1228194587.5, 1228246073.0, 1228297558.5, 1228349044.0, 1228400529.5, 1228452015.0, 1228503500.5, 1228554986.0, 1228606471.5, 1228657957.0, 1228709442.5, 1228760928.0, 1228812413.5, 1228863899.0, 1228915384.5, 1228966870.0, 1229018355.5, 1229069841.0, 1229121326.5, 1229172812.0, 1229224297.5, 1229275783.0, 1229327268.5, 1229378754.0, 1229430239.5, 1229481725.0, 1229533210.5, 1229584696.0, 1229636181.5, 1229687667.0, 1229739152.5, 1229790638.0, 1229842123.5, 1229893609.0, 1229945094.5, 1229996580.0, 1230048065.5, 1230099551.0, 1230151036.5, 1230202522.0, 1230254007.5, 1230305493.0, 1230356978.5, 1230408464.0, 1230459949.5, 1230511435.0, 1230562920.5, 1230614406.0, 1230665891.5, 1230717377.0, 1230768862.5, 1230820348.0, 1230871833.5, 1230923319.0, 1230974804.5, 1231026290.0, 1231077775.5, 1231129261.0, 1231180746.5, 1231232232.0, 1231283717.5, 1231335203.0, 1231386688.5, 1231438174.0, 1231489659.5, 1231541145.0, 1231592630.5, 1231644116.0, 1231695601.5, 1231747087.0, 1231798572.5, 1231850058.0, 1231901543.5, 1231953029.0, 1232004514.5, 1232056000.0, 1232107485.5, 1232158971.0, 1232210456.5, 1232261942.0, 1232313427.5, 1232364913.0, 1232416398.5, 1232467884.0, 1232519369.5, 1232570855.0, 1232622340.5, 1232673826.0, 1232725311.5, 1232776797.0, 1232828282.5, 1232879768.0, 1232931253.5, 1232982739.0, 1233034224.5, 1233085710.0, 1233137195.5, 1233188681.0, 1233240166.5, 1233291652.0, 1233343137.5, 1233394623.0, 1233446108.5, 1233497594.0, 1233549079.5, 1233600565.0, 1233652050.5, 1233703536.0, 1233755021.5, 1233806507.0, 1233857992.5, 1233909478.0, 1233960963.5, 1234012449.0, 1234063934.5, 1234115420.0, 1234166905.5, 1234218391.0, 1234269876.5, 1234321362.0, 1234372847.5, 1234424333.0, 1234475818.5, 1234527304.0, 1234578789.5, 1234630275.0, 1234681760.5, 1234733246.0, 1234784731.5, 1234836217.0, 1234887702.5, 1234939188.0, 1234990673.5, 1235042159.0, 1235093644.5, 1235145130.0, 1235196615.5, 1235248101.0, 1235299586.5, 1235351072.0, 1235402557.5, 1235454043.0, 1235505528.5, 1235557014.0, 1235608499.5, 1235659985.0, 1235711470.5, 1235762956.0, 1235814441.5, 1235865927.0, 1235917412.5, 1235968898.0, 1236020383.5, 1236071869.0, 1236123354.5, 1236174840.0, 1236226325.5, 1236277811.0, 1236329296.5, 1236380782.0, 1236432267.5, 1236483753.0, 1236535238.5, 1236586724.0, 1236638209.5, 1236689695.0, 1236741180.5, 1236792666.0, 1236844151.5, 1236895637.0, 1236947122.5, 1236998608.0, 1237050093.5, 1237101579.0, 1237153064.5, 1237204550.0, 1237256035.5, 1237307521.0, 1237359006.5, 1237410492.0, 1237461977.5, 1237513463.0, 1237564948.5, 1237616434.0, 1237667919.5, 1237719405.0, 1237770890.5, 1237822376.0, 1237873861.5, 1237925347.0, 1237976832.5, 1238028318.0, 1238079803.5, 1238131289.0, 1238182774.5, 1238234260.0, 1238285745.5, 1238337231.0, 1238388716.5, 1238440202.0, 1238491687.5, 1238543173.0, 1238594658.5, 1238646144.0, 1238697629.5, 1238749115.0, 1238800600.5, 1238852086.0, 1238903571.5, 1238955057.0, 1239006542.5, 1239058028.0, 1239109513.5, 1239160999.0, 1239212484.5, 1239263970.0, 1239315455.5, 1239366941.0, 1239418426.5, 1239469912.0, 1239521397.5, 1239572883.0, 1239624368.5, 1239675854.0, 1239727339.5, 1239778825.0, 1239830310.5, 1239881796.0, 1239933281.5, 1239984767.0, 1240036252.5, 1240087738.0, 1240139223.5, 1240190709.0, 1240242194.5, 1240293680.0, 1240345165.5, 1240396651.0, 1240448136.5, 1240499622.0, 1240551107.5, 1240602593.0, 1240654078.5, 1240705564.0, 1240757049.5, 1240808535.0, 1240860020.5, 1240911506.0, 1240962991.5, 1241014477.0, 1241065962.5, 1241117448.0, 1241168933.5, 1241220419.0, 1241271904.5, 1241323390.0, 1241374875.5, 1241426361.0, 1241477846.5, 1241529332.0, 1241580817.5, 1241632303.0, 1241683788.5, 1241735274.0, 1241786759.5, 1241838245.0, 1241889730.5, 1241941216.0, 1241992701.5, 1242044187.0, 1242095672.5, 1242147158.0, 1242198643.5, 1242250129.0, 1242301614.5, 1242353100.0, 1242404585.5, 1242456071.0, 1242507556.5, 1242559042.0, 1242610527.5, 1242662013.0, 1242713498.5, 1242764984.0, 1242816469.5, 1242867955.0, 1242919440.5, 1242970926.0, 1243022411.5, 1243073897.0, 1243125382.5, 1243176868.0, 1243228353.5, 1243279839.0, 1243331324.5, 1243382810.0, 1243434295.5, 1243485781.0, 1243537266.5, 1243588752.0, 1243640237.5, 1243691723.0, 1243743208.5, 1243794694.0, 1243846179.5, 1243897665.0, 1243949150.5, 1244000636.0, 1244052121.5, 1244103607.0, 1244155092.5, 1244206578.0, 1244258063.5, 1244309549.0, 1244361034.5, 1244412520.0, 1244464005.5, 1244515491.0, 1244566976.5, 1244618462.0, 1244669947.5, 1244721433.0, 1244772918.5, 1244824404.0, 1244875889.5, 1244927375.0, 1244978860.5, 1245030346.0, 1245081831.5, 1245133317.0, 1245184802.5, 1245236288.0, 1245287773.5, 1245339259.0, 1245390744.5, 1245442230.0, 1245493715.5, 1245545201.0, 1245596686.5, 1245648172.0, 1245699657.5, 1245751143.0, 1245802628.5, 1245854114.0, 1245905599.5, 1245957085.0, 1246008570.5, 1246060056.0, 1246111541.5, 1246163027.0, 1246214512.5, 1246265998.0, 1246317483.5, 1246368969.0, 1246420454.5]
0
0 1.220729e 09
1 1.220781e 09
2 1.220832e 09
3 1.220884e 09
4 1.220935e 09
.. ...
495 1.246215e 09
496 1.246266e 09
497 1.246317e 09
498 1.246369e 09
499 1.246420e 09
[500 rows x 1 columns]
This is where main ends
Python v.: 3.6.5
CodePudding user response:
You could change the default pandas float formatting:
>>> pd.options.display.float_format = str
>>> pd.DataFrame(periods_separators)
0
0 1220729190.0
1 1220780675.5
2 1220832161.0
3 1220883646.5
4 1220935132.0
.. ...
495 1246214512.5
496 1246265998.0
497 1246317483.5
498 1246368969.0
499 1246420454.5
[500 rows x 1 columns]
>>>