Repository navigation
Closed
Description
This is a feature request for Astropy table (related to, but separate from #2998).
HDUList has the info method that prints a summary of the HDUs in the list.
How about adding an info or summary method to Table that prints a summary of which columns it contains plus some basic stats for numerical columns plus info on the number of "good" (i.e. non-masked) elements.
As an illustration what I mean, here's what stilts tpipe does:
$ stilts tpipe ./gammapy/datasets/data/tev_catalogs/tevcat.fits.gz omode=stats
Total Rows: 173
+------------------+------------+------------+------------+-----------+------+
| column | mean | stdDev | min | max | good |
+------------------+------------+------------+------------+-----------+------+
| canonical_name | | | | | 173 |
| catalog_id | | | | | 173 |
| catalog_id_name | | | | | 173 |
| catalog_name | | | | | 173 |
| coord_dec | -4.2542686 | 39.261513 | -69.16583 | 72.98361 | 173 |
| coord_gal_lat | 2.575876 | 28.594221 | -87.96714 | 83.41788 | 173 |
| coord_gal_lon | 174.05411 | 121.33482 | 0.87189746 | 359.94485 | 173 |
| coord_ra | 206.73235 | 93.13067 | 1.6083333 | 359.78925 | 173 |
| coord_type | -95.566475 | 18.114359 | -99 | 0 | 173 |
| discoverer | 7.2543354 | 3.168495 | 1 | 19 | 173 |
| discovery_date | | | | | 173 |
| distance_value | 73.530266 | 463.1952 | 0.00183 | 3900.0 | 126 |
| distance_type | | | | | 124 |
| distance_kpc | 372831.47 | 818103.4 | 0.102 | 6261886.0 | 126 |
| eth | 1126.8209 | 4123.756 | 0.4 | 35000.0 | 143 |
| flux | 0.1374593 | 0.26819348 | 0.0017 | 2.0 | 140 |
| id | 163.36417 | 52.96711 | 74 | 254 | 173 |
| observatory_name | | | | | 173 |
| other_names | | | | | 96 |
| owner | -37.687862 | 48.745483 | -99 | 2 | 173 |
| size_x | 0.30347693 | 0.4286603 | 0.02 | 2.6 | 65 |
| size_y | 0.24755384 | 0.3756975 | 0.02 | 2.6 | 65 |
| source_type | 14.433526 | 9.782161 | 1 | 37 | 173 |
| source_type_name | | | | | 173 |
| spec_idx | 2.5542648 | 1.0718743 | -3.6 | 5.4 | 102 |
| src_rank | -0.6820809 | 10.654184 | -99 | 1 | 173 |
| variability | -45.11561 | 49.39926 | -99 | 2 | 173 |
+------------------+------------+------------+------------+-----------+------+
Activity
astrofrog commentedon Sep 30, 2014
+1
taldcroft commentedon Sep 30, 2014
👍 on
info()methods forTable,Row,Column,MaskedColumnthat generate useful informational summaries of these objects. Great idea. Having control of the information that gets printed viainfokeywords would be good. As above, astatsmode is good, but you might want basic info likeunit,format,dtype.It should probably return some object class that has appropriate
__repr__,__str__, and_html_repr_methods. Or the simplist thing, just an Astropy Table with columns filled accordingly.rashoodkhan commentedon Dec 2, 2014
I will be interested to take this up if no one is working on it yet.
astrofrog commentedon Dec 2, 2014
@rashoodkhan - I don't think anyone is working on this. Thanks for volunteering!
cdeil commentedon Dec 2, 2014
Thanks @rashoodkhan !
I think @taldcroft's suggestion of generating a new table might be best ? It means you don't have to figure out e.g. nice float formatting and it's even possible to just save it to file.
rashoodkhan commentedon Dec 2, 2014
Both the options presented by @taldcroft seems good, returning an Astropy table will be easier to implement, it will be calculating/extracting data from existing table and creating a new table. I will have a look at stilts and then come up with what information we should be displaying.
cdeil commentedon Dec 2, 2014
Note that stilts is GPL licensed and thus you shouldn't read their code before implementing this (I think). But you can run
stiltsand use it's options and output as an example while developing your code forastropy.table.rashoodkhan commentedon Dec 2, 2014
Sure thing, will keep that in mind. I will be just using its output to develop the specifications.
rashoodkhan commentedon Dec 8, 2014
I am planning to implement the following information from given
Column(Inspired -Its inspired from the above example by @cdeil., Please update the above list for more options to be displayed. Along this I will work on #2998. I looked in to
HDUlist.info()to see how info() was implemented.embray commentedon Dec 8, 2014
I wouldn't really look at that :)
rashoodkhan commentedon Dec 8, 2014
Yeah I realized that the functionality of info() for Table will differ a lot from HDUList.info(), as I'm pretty new to Python, I am trying to read some related code-base when working on issues. So far, its going good! 😄
taldcroft commentedon Dec 12, 2014
@rashoodkhan - how's it going on this? We'd definitely like to get this in for the 1.0 release. This means a PR should be merged by next Friday, so just wondering if you think you will have time to work on this in the next week.
SaOgaz commentedon Jun 28, 2016
Is there still a need for this? It was kind of hard to follow all the other linked (and indirectly linked) issues. And looking at the docs, it's doesn't seem like
table.info()is doing this at the moment?taldcroft commentedon Jun 28, 2016
@SaraOgaz - this is done now, closed by #3731.