Closed dwolffram closed 1 month ago
Hi @dwolffram, yes there are a couple of ways:
TimeSeries.random_component_values()
returns a 2D array (T, C) with times and random a sample from each component.TimeSeries.values(copy=True, sample=0)
returns a 2D array (T, C) with times and a sample at index sample
from each component.TimeSeries.all_values()
returns a 3D array (T, C, S) with times, components, and all samples for each time and component.Thanks @dennisbader but these all return a numpy.ndarray
and not a TimeSeries
.
In the case of a multivariate series, you can do something like series['component_name']
to retrieve a univariate TimeSeries
. But there is no way of indexing a stochastic series to retrieve one sample as a TimeSeries
, right?
Ah sorry, you are right.
You would have to create a new series from the values. with series.with_values()
, you can return a new series that has the same components and times as series
, but with new values.
E.g.
new_series = series.with_values(series.values(sample=0))
Thanks, that was helpful!
However, I got the error ValueError: different number of dimensions on data and dims: 2 vs 3
. After adding another dimension it works though:
new_series = series.with_values(np.expand_dims(series.values(sample=0), 1))
True 👍
Hi there,
is there a simple way to retrieve one sample of a probabilistic series as a TimeSeries object? I only found univariate_values() which returns a 1-D Numpy array.
Thanks!