You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to set the unit for multiple columns of a QTable
Expected behavior
Set the unit of multiple columns in one command:
table=QTable(names=["a","b","c","d","e"])
table["a"].unit=u.A# works like expectedtable["b", "c", "d"].unit=u.mV# does not work like expectedtable[table.columns[1:3]].unit=u.mV# slicing would be nice but does not work eather
Actual behavior
table["b","c","d"] returns a copy of the table and not a view. Therefor the changing the units has no effect.
Workaround if someone stumbles about this:
Use a loop to set the unit for each column individually
forcolintable.columns[1:3]:
table[col].unit=u.mV
Suggestion
If returning a view is not desirable, maybe an attribute table.units could be introduced, exposing some way to manipulate multiple units
table.units[1:3] =u.mV# or maybetable.units[table.columns[1:3]] =u.mV
Welcome to Astropy 👋 and thank you for your first issue!
A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.
GitHub issues in the Astropy repository are used to track bug reports and feature requests; If your issue poses a question about how to use Astropy, please instead raise your question in the Astropy Discourse user forum and close this issue.
If you feel that this issue has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.
@taldcroft it looks to me that nothing is actually broken here and there's even a mention of a supported way of achieving the desired result so I would recommend changing the "bug" label for a "question" and close the issue as "won't fix".
Description
I would like to set the unit for multiple columns of a QTable
Expected behavior
Set the unit of multiple columns in one command:
Actual behavior
table["b","c","d"]
returns a copy of the table and not a view. Therefor the changing the units has no effect.Workaround if someone stumbles about this:
Use a loop to set the unit for each column individually
Suggestion
If returning a view is not desirable, maybe an attribute
table.units
could be introduced, exposing some way to manipulate multiple unitsSystem Details
Linux-5.10.0-12-amd64...
Python 3.9.2
Numpy 1.22.1
pyerfa 2.0.0.1
astropy 5.0.1
Scipy 1.7.3
Matplotlib 3.5.1
The text was updated successfully, but these errors were encountered: