appending ascii tables with strings #41

Closed
ghost opened this Issue Mar 25, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Mar 25, 2012

Appending ascii tables with strings fails when the string lengths are
different. This probably also effects other table formats. An example
is show below.

Is there a work arround? Some example code would help while a general
solution is generated. I am happy to test any solution

Thanks

"""Example ascii table append
"""

import atpy

Simple space-delimited ASCII table

table1 = """
int string
1 a
4 ab
9 abc
"""

table2 = """
int string
1 abcd
3 abcde
8 abcdef
"""

t1 = atpy.Table(table1, type='ascii')
t1.describe()

t2 = atpy.Table(table2, type='ascii')
t2.describe()

for column in t1.columns:
if t1.data[column].dtype.name != t2.data[column].dtype.name:
print t1.data[column].dtype, t2.data[column].dtype
print t1.columns[column], t2.columns[column]
print t1.data[column].dtype.name, t2.data[column].dtype.name
print

t1.append(t2)
t1.describe()

@astrofrog

This comment has been minimized.

Show comment
Hide comment
@astrofrog

astrofrog Jul 26, 2013

Member

This is a duplicate of #15 so I will close this one.

Member

astrofrog commented Jul 26, 2013

This is a duplicate of #15 so I will close this one.

@astrofrog astrofrog closed this Jul 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment