I have an excel file produced automatically with occasional very large numbers like 135061808695
. In the excel file when you click on the cell it shows the full number 135061808695
however visually with the automatic "General" format the number appears as 1.35063E+11
.
When I use ExcelFile
in Pandas the it pulls the value in scientific notation 1.350618e+11
instead of the full 135061808695
. Is there any way to get Pandas to pull the full value without going in an messing with the excel file?
Scientific notations isn't helpful when you are trying to make quick comparisons across your dataset. However, Pandas will introduce scientific notations by default when the data type is a float.
Pandas might very well be pulling the full value but not showing it in its default output:
df = pd.DataFrame({ 'x':[135061808695.] })
df.x
0 1.350618e+11
Name: x, dtype: float64
Standard python format:
print "%15.0f" % df.x
135061808695
Or in pandas, convert to an integer type to get integer formatting:
df.x.astype(np.int64)
0 135061808695
Name: x, dtype: int64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With