Dear All,

I have a text based file look like this:

sample.txt
#int_val  float_val str_val
1    1.23    sample1
2    2.12    sample2
3    3.1     sample3

Now I want to read it into a pytables table, using it's embedded numpy
array function process those columns, then store a data copy to a sqlite
database as well as a hdf5 table, better write to a new text file either.

I read the manual and found numpy.loadtxt can read the text, however, I
get no idea how to do it in pytables.

And one more question is for the column str_val, so far as I know, the
numpy array's dtype for string is come with limited length, if I need
change the string "sample3" to a "long_long_long_string", how I can
change the str_val's dtype and make sure the remained data (sample1 and
sample2 in this case) unchanged? I tested in numpy and found it not works.

>>>array(['sample1', 'sample2', 'sample3'],
      dtype='|S7')
>>>arr.dtpye='|S14'
ValueError: new type not compatible with array.

Then I want to know if there's solution in pytables can solve this problem?

I am new to pytables, may I ask expert give a code sample for this case
here?

PS, can I read the sqlite database's data into a pytables table without
pain directly?

Thanks!

Rgs,

KC

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to