Hi.
pyTables saves wrong data to file. I read the docs, but I don't know what
I'm doing wrong. It's the first time I noticed this kind of behavior. Any
suggestions?
*problem: *
writing items in testL = [12.12, 12.1234567] to table
data in table: col1 = 12.1199998856, col2 = 12.1234569550
expected: col1 = 12.12, col2 = 12.1234567
*script:*
class MyDescrClass(IsDescription):
eventDate = Float64Col()
col1 = Float32Col()
col2 = Float32Col()
newdb = "_misc/db/test.h5"
dbFilters = tables.Filters(complevel=9, complib='blosc', shuffle=1)
h5file = tables.openFile(db, filters=dbFilters, mode="a")
testL = [12.12, 12.1234567]
print("data in list: %.10f, %.10f" % (testL[0], testL[1]))
newh5file = tables.openFile(newdb, filters=dbFilters, mode="a")
newh5file.createTable(newh5file.root, "myTable", MyDescrClass, "someTitle",
filters=dbFilters, expectedrows=1000000000)
testT = newh5file.root.myTable
testT.row["col1"] = testL[0]
testT.row["col2"] = testL[1]
testT.row["eventDate"] = 1311530521.215325
testT.row.append()
testT.flush()
for row in testT:
print("data in table: col1 = %.10f, col2 = %.10f" % (row["col1"],
row["col2"]))
newh5file.close()
*output:*
data in list: 12.1200000000, 12.1234567000
data in table: col1 = 12.1199998856, col2 = 12.1234569550
tables.print_versions()
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
PyTables version: 2.4.0
HDF5 version: 1.8.4-patch1
NumPy version: 1.6.1
Numexpr version: 1.4.2 (not using Intel's VML/MKL)
Zlib version: 1.2.3.4 (in Python interpreter)
BZIP2 version: 1.0.6 (6-Sept-2010)
Blosc version: 1.1.3 (2010-11-16)
Cython version: 0.15.1
Python version: 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3]
Platform: linux2-x86_64
Byte-ordering: little
Detected cores: 4
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users