Skip to content

Loading…

appending ascii tables with strings #41

Closed
ghost opened this Issue · 1 comment

1 participant

@ghost

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
ATpy member

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

@astrofrog astrofrog closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.