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 have found another minor error message that is counter-intuitive.
This one happens if one creates a HistoricalSignal from two pd.Series with different names. _resample_to_frequency will then fail for anything except bfill.
As far as I can tell from looking at the source, this would happen even after applying the fixes in #232.
The code tries to look up data in actual with the series name from forecast.
If one looks at the source code for __init__, this behaviour makes sense, as the name of the series is used instead of a column name, and when dealing with DataFrames with multiple columns it is clear that both DataFrames should contain the same column name.
When using Series, this seems a bit counter intuitive though, at least to me, because there is only one column, and little care is often given to the name of the Series object. (It is true that Series are not mentioned in the init docstring at all, but it is quite evident how to use HistoricalSignal with them.)
Even worse, this also happens if the series name is left blank (and the other is not), as it was the case when I first came across the behaviour. The associated column name will be the string"None", resulting in a ValueError: Cannot retrieve data for column 'None'. Which is extra confusing, seeing as _get_column_name specifically has a check for a column of None.
I'd suggest either:
Mention in the doc for HistoricalSignal that series names are used as column names (and thus need to be the same).
Not converting a series name of None to "None" (though this only solves the case in which one of the series has an unspecified name).
Not using the series name as column name in _resample_to_frequency and instead always use a column name of None when dealing with one-column data in this line:
I have found another minor error message that is counter-intuitive.
This one happens if one creates a
HistoricalSignal
from twopd.Series
with different names._resample_to_frequency
will then fail for anything exceptbfill
.Tested with vessim 0.8.0:
As far as I can tell from looking at the source, this would happen even after applying the fixes in #232.
The code tries to look up data in
actual
with the series name fromforecast
.If one looks at the source code for
__init__
, this behaviour makes sense, as the name of the series is used instead of a column name, and when dealing with DataFrames with multiple columns it is clear that both DataFrames should contain the same column name.When using Series, this seems a bit counter intuitive though, at least to me, because there is only one
column
, and little care is often given to the name of the Series object. (It is true that Series are not mentioned in the init docstring at all, but it is quite evident how to use HistoricalSignal with them.)Even worse, this also happens if the series name is left blank (and the other is not), as it was the case when I first came across the behaviour. The associated column name will be the string
"None"
, resulting in aValueError: Cannot retrieve data for column 'None'
. Which is extra confusing, seeing as_get_column_name
specifically has a check for a column ofNone
.I'd suggest either:
None
to"None"
(though this only solves the case in which one of the series has an unspecified name)._resample_to_frequency
and instead always use a column name ofNone
when dealing with one-column data in this line:vessim/vessim/signal.py
Line 349 in 648d3b3
i.e.
self.now(start_time, None if len(data) == 1 else column)
The text was updated successfully, but these errors were encountered: