<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Tom & Thomas,<div class=""><br class=""></div><div class="">Many thanks - I should have known/noticed.</div><div class=""><br class=""></div><div class="">I note, however, that the syntax that is mentioned (in the docs in a different context)</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>t['a','c']</div><div class=""><br class=""></div><div class="">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</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>t.pprint (['a','c'])</div><div class=""><br class=""></div><div class="">or</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>t.pprint (names=['a','c'])</div><div class=""><br class=""></div><div class="">though not as elegant looking, perhaps, would permit the printing with no copying needed.  After all, I just want the table printed out.</div><div class=""><br class=""></div><div class="">Re docs: I would still add more examples to the docs to emphasize the range of options, something like</div><div class=""><br class=""></div><div class=""><br class=""><div><div class="section" id="basics"><p style="font-size: 13px; line-height: 18px; margin-top: 0px; margin-bottom: 9px; -webkit-hyphens: auto;" class=""><strong style="font-style: inherit;" class="">Print table or column</strong></p><div class="notranslate highlight-default" style="clear: both; margin: 1em 0px; position: relative;"><div class="highlight" style="background-color: rgb(238, 255, 204); background-position: initial initial; background-repeat: initial initial;"><pre style="line-height: 18px; overflow: auto hidden; clear: both; padding: 8.5px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; margin-top: 0px; margin-bottom: 0px; border: 1px solid rgba(0, 0, 0, 0.12); word-wrap: break-word; background-color: rgb(248, 248, 248);" class=""><span class="nb" style="color: rgb(0, 112, 32);">print</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>     <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Print formatted version of table to the screen</span>
<span class="n">t</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">pprint</span><span class="p">()</span>   <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Same as above</span>
<span class="n">t</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">show_unit</span><span class="o" style="color: rgb(102, 102, 102);">=</span><span class="kc" style="color: rgb(0, 112, 32); font-weight: bold;">True</span><span class="p">)</span>  <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Show column unit</span>
<span class="n">t</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">show_name</span><span class="o" style="color: rgb(102, 102, 102);">=</span><span class="kc" style="color: rgb(0, 112, 32); font-weight: bold;">False</span><span class="p">)</span>  <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Do not show column names</span>
<span class="n">t</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">pprint_all</span><span class="p">()</span> <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Print full table no matter how long / wide it is (same as t.pprint(max_lines=-1, max_width=-1))</span>

<span class="n">t</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">more</span><span class="p">()</span>  <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Interactively scroll through table like Unix "more"</span>

<span class="nb" style="color: rgb(0, 112, 32);">print</span><span class="p">(</span><span class="n">t</span><span class="p">[</span><span class="s1" style="color: rgb(64, 112, 160);">'a'</span><span class="p">])</span>    <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Formatted column values</span>
<span class="n">t</span><span class="p">[</span><span class="s1" style="color: rgb(64, 112, 160);">'a'</span><span class="p">]</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">pprint</span><span class="p">()</span>  <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Same as above, with same options as Table.pprint()</span>
<span class="n">t</span><span class="p">[</span><span class="s1" style="color: rgb(64, 112, 160);">'a'</span><span class="p">]</span><span class="o" style="color: rgb(102, 102, 102);">.</span><span class="n">more</span><span class="p">()</span>    <span class="c1" style="color: rgb(64, 128, 144); font-style: italic;"># Interactively scroll through column</span>
t['a','b'].more() # Interactively scroll 2 columns (also works with pprint) </pre></div></div></div><div class="section" id="details"></div><div><br class=""></div>at the top (for obivously superficial readers like myself) and below</div><div><br class=""></div><div><h4 style="color: rgb(64, 64, 64); margin: 0.7em 0px 0px; line-height: 1.5em; font-size: 16px; caret-color: rgb(64, 64, 64); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;" class="">Hiding columns<a class="headerlink" href="https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns" title="Permalink to this headline" style="color: rgb(0, 105, 214); text-decoration: none; line-height: inherit; font-weight: inherit; visibility: hidden; font-size: 0.8em; padding: 0px 4px;"></a></h4><p style="font-size: 13px; line-height: 18px; margin-top: 0px; margin-bottom: 9px; -webkit-hyphens: auto; caret-color: rgb(64, 64, 64); color: rgb(64, 64, 64); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;" class="">The <a class="internal reference" href="https://docs.astropy.org/en/latest/api/astropy.table.Table.html#astropy.table.Table" title="astropy.table.Table" style="color: rgb(0, 105, 214); text-decoration: none; line-height: inherit;"><code class="literal py notranslate docutils xref py-class" style="padding: 0px 1px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; margin: 0px; border: none; font-weight: bold;"><span class="pre" style="-webkit-hyphens: none;">Table</span></code></a> class has two ways to selectively show certain columns when using any of the print methods. For simple cases, use the standard syntax</p><p style="font-size: 13px; line-height: 18px; margin-top: 0px; margin-bottom: 9px; -webkit-hyphens: auto; caret-color: rgb(64, 64, 64); color: rgb(64, 64, 64); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>t['col1','col999'].pprint()</p><p style="font-size: 13px; line-height: 18px; margin-top: 0px; margin-bottom: 9px; -webkit-hyphens: auto; caret-color: rgb(64, 64, 64); color: rgb(64, 64, 64); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;" class="">(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. ...</p><div class=""><br class=""></div><div class="">Again, many thanks!</div><div class=""><br class=""></div><div class="">Rick</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class="">On 26 Feb 2021, at 12:31, Aldcroft, Thomas <<a href="mailto:aldcroft@head.cfa.harvard.edu" class="">aldcroft@head.cfa.harvard.edu</a>> wro</div></blockquote><blockquote type="cite" class=""><div class="">te:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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:<div class="">  <a href="https://github.com/astropy/astropy/pull/11354" class="">https://github.com/astropy/astropy/pull/11354</a>.<div class=""><br class=""></div><div class="">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:</div><div class="">  <a href="https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns" class="">https://docs.astropy.org/en/latest/table/access_table.html#hiding-columns</a></div><div class=""><br class=""></div><div class="">- Tom</div><div class=""><br class=""></div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 26, 2021 at 4:45 AM Thomas Boch <<a href="mailto:thomas.boch@astro.unistra.fr" class="">thomas.boch@astro.unistra.fr</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Rick,<br class="">
<br class="">
What about:<br class="">
<br class="">
tabl['col1', 'col99'].pprint()<br class="">
<br class="">
?<br class="">
<br class="">
Cheers,<br class="">
<br class="">
Thomas<br class="">
<br class="">
Le 26/02/2021 à 09:54, Frederic V. Hessman a écrit :<br class="">
> Surely there's a simple way to pprint only selected columns of a table, something like<br class="">
><br class="">
>>>> tabl.pprint (names=['col1','col99'])<br class="">
> but I haven't seen anything obvious.  Yes, there are brute force work-arounds, but....<br class="">
><br class="">
> Rick<br class="">
> _______________________________________________<br class="">
> AstroPy mailing list<br class="">
> <a href="mailto:AstroPy@python.org" target="_blank" class="">AstroPy@python.org</a><br class="">
> <a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailman/listinfo/astropy</a><br class="">
<br class="">
_______________________________________________<br class="">
AstroPy mailing list<br class="">
<a href="mailto:AstroPy@python.org" target="_blank" class="">AstroPy@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailman/listinfo/astropy</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>