question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TimeSeries: misleading exception when required column check fails.

See original GitHub issue

Description

For a TimeSeries object that has additional required columns (in addition to time), when codes mistakenly try to remove a required column, the exception it produces is misleading.

Expected behavior

An exception that informs the users required columns are missing.

Actual behavior

The actual exception message is confusing: ValueError: TimeSeries object is invalid - expected 'time' as the first columns but found 'time'

Steps to Reproduce

from astropy.time import Time
from astropy.timeseries import TimeSeries

time=Time(np.arange(100000, 100003), format='jd')
ts = TimeSeries(time=time, data = {"flux": [99.9, 99.8, 99.7]})
ts._required_columns = ["time", "flux"]                                   
ts.remove_column("flux")

System Details

Windows-10-10.0.22000-SP0
Python 3.9.10 | packaged by conda-forge | (main, Feb  1 2022, 21:21:54) [MSC v.1929 64 bit (AMD64)]
Numpy 1.22.3
pyerfa 2.0.0.1
astropy 5.0.3
Scipy 1.8.0
Matplotlib 3.5.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
orionleecommented, Mar 30, 2022

I use a brand new conda env (upgrading my old python 3.7, astropy 4 based env is not worth trouble).

  • I just found astropy.test() method works for me. So for this small fix it probably suffices.
> astropy.test(test_path="astropy/timeseries/tests/test_common.py")
  • I read some posts online on Plugin already registered error in other projects, they seem to indicate some symlink issues making pytest reading contest.py twice, but I can’t seem to find such problems in my environment (my astropy is an editable install, so the path to the source is directly used).
1reaction
orionleecommented, Mar 29, 2022

Proposal: change the message to the form of:

ValueError: TimeSeries object is invalid - required ['time', 'flux'] as the first columns but found ['time']
Read more comments on GitHub >

github_iconTop Results From Across the Web

decompose() for time series: ValueError: You must specify a ...
Use three columns: [list of data] + [timestamp] + [duration] for details how to unnest a list column. This would be needed for...
Read more >
Exception Reporting in Power BI: Catch the Error Rows in ...
In the output column named Error, click on Expand again and this time select all columns;. It is good to have the original...
Read more >
Time Series Messages (TS)
Cause: This is the generic internal error number for Time Series exceptions. This indicates that a process has encountered an exceptional condition.
Read more >
Anomaly Detection in Time Series Sensor Data
We can already see that the data requires some cleaning, there are missing values, an empty column and a timestamp with an incorrect...
Read more >
azureml.data.TabularDataset class - Microsoft Learn
Represents a tabular dataset to use in Azure Machine Learning. A TabularDataset defines a series of lazily-evaluated, immutable operations to load data from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found