Sorting table with `Time` column fails
See original GitHub issueTrying to sort a table with a time column fails:
from astropy.time import Time
from astropy.table import Table
from astropy.coordinates import EarthLocation
t = Table()
t['a'] = Time([100.0, 200.0], scale='tt', format='mjd',
location=EarthLocation(-2446354, 4237210, 4077985, unit='m'))
t['b'] = [3, 1]
t.sort('b')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-60-186ab71ceb04> in <module>()
6 location=EarthLocation(-2446354, 4237210, 4077985, unit='m'))
7 t['b'] = [3, 1]
----> 8 t.sort('b')
~/conda-main/envs/ipyfits/lib/python3.6/site-packages/astropy/table/table.py in sort(self, keys)
2475
2476 for col in self.columns.values():
-> 2477 col[:] = col.take(indexes, axis=0)
2478
2479 if sort_index is not None:
TypeError: 'Time' object does not support item assignment
(Apologies if all of the issues I’m opening here are known issues or the expected behavior)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Cannot sort table by Time column #10823 - astropy ... - GitHub
I want to sort the rows by that column with Time objects. I get AttributeError: 'Time' object has no attribute 'view' error.
Read more >Excel can't properly sort by time - Microsoft Community
I've copied 2 first columns in the new file and tried sorting there. The result is exactly the same. Yes I use multi...
Read more >Excel date formatting NOT working? Dates not sorting in Excel?
This way, any pivot tables or charts attached to the dates will be working with valid dates and sort orders will not be...
Read more >Solved: date/time column sort - Microsoft Power BI Community
I am trying to sort my table in ascending order by a Date/Time column. I have already formatted this column's Data Type into...
Read more >How to Sort in Excel Rows or Columns Avoid Sort Problems
If there is a blank row or blank column in the data, part of the data might be sorted, while other data is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes sorting relies on Time being mutable which is a new feature of 3.1!
@mwcraig - I suspect it’s not, I vaguely remember the sorting is relying on a new feature/API change added after the LTS (but somehow cannot find the PRs now).