python - save currencies to pandas store with precision (as Decimal?) -


I work a lot with currencies in pandas till this point I am using default floats, but lack of precision Dealing with is troubling and error prone. I'm trying to switch to using decimal for a few pieces, whereas when this is probably very slow, it is accurate but when I try to save in the Pandos Store (Such as hdf5store via pytables) I find: TypeError: can not serial column [O] because its data content is [mixed] object DTP

What do I do There is a small sample of am trying to:

import as import

Import pandas as decimals by decimals by teststore = pd.HDFStore ('teststore.h5') df = pd.DataFrame (data = {'o': [decimal ('5.1')]} TestStore ['Test'] = DF

.. which raises the exception. df.convert_objects (convert_numeric = true) help

Is there a way to save a decimal in a Pond's shop, and if not, then a recommended method is to store currencies in the Pandos Store

I python 2.7.8, panda 0.14 .1, and I'm using Paitable 3.1.1.

0.15.0 although it is essentially spicy as a real dragon object , So you did not get any benefit from using HDF5 <46>: In [46]: Decimal import from decimal [47]: teststore = pd. In HDFstore ('teststore.h5') [48]: df = pd.DataFrame (data = {'o': [decimal ('5.1')]} in [49]: teststore ['test'] = df Panda /io/pytables.py#487: Performance Warning: Practical object types can pick up because it's C-type [inferred_type-> Mixed, Key-> Block0_value] [Item- & gt; [['' O ']] Warnings. Wired (WS, Performance Warning) is typically 14-16 points as float 64 in FII, so it is not sure why you are not using them (you may need [50] in: In [34]: PD. (In 'precision', 16) [51]: In [35]: S = Series ([0.0000000000001,0.000000000000002]) In [52]: s + s Out [52]: 0.000000000000200 1 0.000000000000004 dtype: float64


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -