VizierClass no longer respects the order of columns requested
- Dominant language
- Python
- Stars
- 791
- Forks
- 451
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Description
VizierClass used to return the columns in the order that the caller requested them, but does not any more. In the example below, the columns requested are `['GWGC', '_RAJ2000', '_DEJ2000', 'Dist']`. In astroquery 0.4.1, they are returned in that order. However, in astroquery 0.4.2, they are returned in a different order.
## Expected (old) behavior, astroquery 0.4.1
```pycon
>>> from astroquery.vizier import VizierClass
>>> vizier = VizierClass(columns=['GWGC', '_RAJ2000', '_DEJ2000', 'Dist'])
>>> cat, = vizier.get_catalogs('VII/281/glade2')
>>> cat
GWGC _RAJ2000 _DEJ2000 Dist
deg deg Mpc
str28 float64 float64 float64
--------- -------------------- -------------------- --------------------
NGC0253 11.8880600000000012 -25.2887990000000045 3.92595099046000
NGC5128 201.3656459999999981 -43.0187110000000104 3.76743399832000
--- 56.7021410000000046 68.0961070000000177 8.35574783250000
NGC5236 204.2529999999999859 -29.8654999999999973 4.46732076201000
NGC4736 192.7214509999999734 41.1201519999999974 4.24571533533000
NGC0055 3.7233399999999999 -39.1966290000000015 2.18817755456000
... ... ... ...
--- 186.0309599999999932 6.6074700000000002 33.59537004350000
IC3652 190.2441099999999778 11.1844080000000012 22.44885791180000
--- 188.2000119999999868 37.6218029999999999 51.65597412030000
NGC4328 185.8335109999999872 15.8205450000000045 8.08313872063000
PGC042497 190.2097319999999741 4.5256780000000010 11.11130436180000
PGC045084 195.8197329999999852 -17.4230309999999982 6.91790412822000
```
## Actual (new) behavior, astroquery 0.4.2
```pycon
>>> from astroquery.vizier import VizierClass
>>> vizier = VizierClass(columns=['GWGC', '_RAJ2000', '_DEJ2000', 'Dist'])
>>> cat, = vizier.get_catalogs('VII/281/glade2')
>>> cat
_RAJ2000 _DEJ2000 GWGC Dist
deg deg Mpc
float64 float64 str28 float64
-------------------- -------------------- --------- --------------------
11.8880600000000012 -25.2887990000000045 NGC0253 3.92595099046000
201.3656459999999981 -43.0187110000000104 NGC5128 3.76743399832000
56.7021410000000046 68.0961070000000177 --- 8.35574783250000
204.2529999999999859 -29.8654999999999973 NGC5236 4.46732076201000
192.7214509999999734 41.1201519999999974 NGC4736 4.24571533533000
3.7233399999999999 -39.1966290000000015 NGC0055 2.18817755456000
... ... ... ...
186.0309599999999932 6.6074700000000002 --- 33.59537004350000
190.2441099999999778 11.1844080000000012 IC3652 22.44885791180000
188.2000119999999868 37.6218029999999999 --- 51.65597412030000
185.8335109999999872 15.8205450000000045 NGC4328 8.08313872063000
190.2097319999999741 4.5256780000000010 PGC042497 11.11130436180000
195.8197329999999852 -17.4230309999999982 PGC045084 6.91790412822000
```
Contributor guide
Research direction
Reproduce the ordering difference with VizierClass(columns=['GWGC', '_RAJ2000', '_DEJ2000', 'Dist']) and get_catalogs('VII/281/glade2'). Start by tracing how VizierClass handles requested columns and compare the 0.4.1 and 0.4.2 behavior. Done means returned tables preserve the caller's column order and a regression test covers this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100