to_pandas() from binned timed series with bin_time_start
See original GitHub issueDescription
I had a problem with astropy binned time series. I have created such an object using the aggregate_downsample function where I specify the time_bin_start = TimeDelta(-600.,format=‘sec’). When I try to use the to_pandas() function on this binned time series, I get the following error:
File "C:\Users\bmm93\anaconda3\lib\site-packages\astropy\table\table.py", line 3314, in to_pandas
kwargs = {'index': out.pop(index)} if index else {}
KeyError: 'time_bin_start'
I have not had trouble with to_pandas() before specifying time_bin_start.
I got response from a user on the ‘Python users in Astronomy’ Facebook group:
“This looks like astropy 4.0.x, and a real bug at that.
Unfortunately with 4.3 or later I can confirm the same even without specifying time_bin_start
!
It should work with to_pandas(index=False)
– can you check if that returns sensible results?
But it would be great if you could submit an issue about this.”
I then tried ‘to_pandas(index=False)’ and I got sensible results. I am using astropy version 4.0.2.
Expected behavior
Actual behavior
Steps to Reproduce
- [First Step]
- [Second Step]
- [and so on…]
# Put your Python code snippet here.
System Details
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Thanks for the bug report! To point out the respective behaviour in 4.0, 4.3 and 5.0, current dev gives
even without a
time_bin_start
option given, whereas the older versions have– in 4.0.2-4.0.5 only with the
time_bin_start
option, in 4.3 even without. In all versions both workarounds pass, though with different results/formats:I think I have a fix, PR coming hopefully.