Question: increasing floating point precision in pandas

0

QVINTVS_FABIVS_MAXIMVS •

**2.3k**wrote:

I have a pandas data frame with mixed types

I would like to increase the floating point precision of the columns with float64 to 500 point precision.

Is there an easy solution using decimal library? I'm having some troubles with the current methods.

from decimal import * getcontext().prec = 500 df['floating'] = df['floating'].astype(Decimal) df['phred'] = -10 * np.log10(1-df['floating'])

Error:

AttributeError: 'float' object has no attribute 'log10

ADD COMMENT
• link
•
modified 4.2 years ago
by
Philipp Bayer ♦

**6.5k**• written 4.2 years ago by QVINTVS_FABIVS_MAXIMVS •**2.3k**
I hope you've considered whether any of the initial values that you're using even have 500 significant digits.

BTW, this is pretty off-topic.

92kThey sure do

2.3k