[AstroPy] weird problem with table column operation
Aldcroft, Thomas
aldcroft at head.cfa.harvard.edu
Tue May 18 12:00:14 EDT 2021
Hi Paul,
You might also find the Table hstack() function useful. This will let you
add all the columns of one table into another table.
https://docs.astropy.org/en/stable/table/operations.html#id6
In your case this might look like:
from astropy.table import hstack
tab = hstack([tab, c1])
- Tom
On Tue, May 18, 2021 at 11:47 AM Adrian Price-Whelan <adrianmpw at gmail.com>
wrote:
> Hi Paul,
>
> This could be because your object c1 is actually a full astropy Table
> rather than just a column, so you are adding a column to "tab" that is a
> full table object. Try:
>
> tab.add_column(c1['TDB_MINUS_TT'])
> or
> tabl['TDB_MINUS_TT'] = c1['TDB_MINUS_TT']
>
> instead?
>
> best,
> Adrian
>
> On Tue, May 18, 2021 at 11:38 AM Paul Kuin <npkuin at gmail.com> wrote:
>
>> Hi,
>>
>> I probably do something wrong.
>>
>> I have a Table with multiple columns, and one with a single colum.
>> In [80]: type(tab),type(c1)
>> Out[80]: (astropy.table.table.Table, astropy.table.table.Table)
>> The data type in c1 is :
>> <Table length=10628>
>> tdb_minus_tt
>> float64
>> -------------------
>> -33.9968477608636
>> -3.307830076664686
>> ....
>>
>> I add this c1 as aa new column using
>> tab.add_column(c1,name='TDB_MINUS_TT') [if I do not add the name the name
>> does not take)
>>
>> now the column is added to table TAB, BUT, the data type is now changed
>> to void64 !?
>> and the values have now been changed from float to (-33.9968477608636 ,)
>> etc.
>>
>> I see no mention in the documentation anywhere of anything like this.
>> Am I doing something stupid or is this a bug?
>>
>> In [86]: astropy.__version__
>> Out[86]: '4.0.2'
>>
>> Anny help will be appreciated!
>>
>> Thanks,
>> Paul
>>
>> --
>>
>> * * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
>> N.P.M. Kuin (n.kuin at ucl.ac.uk) -- mobile +44(0)7908715953 -- phone
>> +44-(0)1483 (prefix) -204111 (when back to work)
>> Mullard Space Science Laboratory – University College London – Holmbury
>> St Mary – Dorking – Surrey RH5 6NT– U.K.
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at python.org
>> https://mail.python.org/mailman/listinfo/astropy
>>
>
>
> --
> Adrian M. Price-Whelan
> Flatiron Institute, NYC
> http://adrn.github.io
> (he / him)
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20210518/018cbb3a/attachment.html>
More information about the AstroPy
mailing list