Frederic V. Hessman
hessman at astro.physik.uni-goettingen.de
Fri Feb 26 07:22:34 EST 2021
Tom & Thomas,
Many thanks - I should have known/noticed.
I note, however, that the syntax that is mentioned (in the docs in a different context)
officially results in a copy of the table, which I may or may not want (who knows - the table might be gargantuous!), while something internal like
though not as elegant looking, perhaps, would permit the printing with no copying needed. After all, I just want the table printed out.
Re docs: I would still add more examples to the docs to emphasize the range of options, something like
Print table or column
print(t) # Print formatted version of table to the screen
t.pprint() # Same as above
t.pprint(show_unit=True) # Show column unit
t.pprint(show_name=False) # Do not show column names
t.pprint_all() # Print full table no matter how long / wide it is (same as t.pprint(max_lines=-1, max_width=-1))
t.more() # Interactively scroll through table like Unix "more"
print(t['a']) # Formatted column values
t['a'].pprint() # Same as above, with same options as Table.pprint()
t['a'].more() # Interactively scroll through column
t['a','b'].more() # Interactively scroll 2 columns (also works with pprint)
at the top (for obivously superficial readers like myself) and below
Hiding columns <https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns>
The Table <https://docs.astropy.org/en/latest/api/astropy.table.Table.html#astropy.table.Table> class has two ways to selectively show certain columns when using any of the print methods. For simple cases, use the standard syntax
(a copy of the table is made). For more formal or complicated cases, using the functionality to consistently show or hide certain columns within the table. The latter method can be useful for columns that are very wide or else “uninteresting” for various reasons. ...
Again, many thanks!
> On 26 Feb 2021, at 12:31, Aldcroft, Thomas <aldcroft at head.cfa.harvard.edu> wro
> Indeed `tabl['col1', 'col99'].pprint()` is the right idiom for printing a subset of columns. I see the docs didn't include anything quite like that, so I added an example. See:
> https://github.com/astropy/astropy/pull/11354 <https://github.com/astropy/astropy/pull/11354>.
> BTW, starting with the next release of astropy (4.3) you can persistently include or exclude selected column names from being printed. This can be helpful if you have a table that has some uninteresting columns, or perhaps a very wide column that dominates printing. See:
> https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns <https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns>
> - Tom
> On Fri, Feb 26, 2021 at 4:45 AM Thomas Boch <thomas.boch at astro.unistra.fr <mailto:thomas.boch at astro.unistra.fr>> wrote:
> Hi Rick,
> What about:
> tabl['col1', 'col99'].pprint()
> Le 26/02/2021 à 09:54, Frederic V. Hessman a écrit :
> > Surely there's a simple way to pprint only selected columns of a table, something like
> >>>> tabl.pprint (names=['col1','col99'])
> > but I haven't seen anything obvious. Yes, there are brute force work-arounds, but....
> > Rick
> > _______________________________________________
> > AstroPy mailing list
> > AstroPy at python.org <mailto:AstroPy at python.org>
> > https://mail.python.org/mailman/listinfo/astropy <https://mail.python.org/mailman/listinfo/astropy>
> AstroPy mailing list
> AstroPy at python.org <mailto:AstroPy at python.org>
> https://mail.python.org/mailman/listinfo/astropy <https://mail.python.org/mailman/listinfo/astropy>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy