[SciPy-user] TimeSeries concatenate

Matt Knox mattknox.ca@gmail....
Fri May 22 15:16:43 CDT 2009


> Question: What happens to duplicate dates?  It seems that the data in  
> the first series is used.  Is that the rule?

One thing I would recommend (which is not obvious to new python users many
times) is to check the function doc strings using the built in "help" function
(see below). So to answer your question, yes that is the rule IF the
`remove_duplicates` parameter is set to "True" (which is the default).

- Matt

>>> import scikits.timeseries as ts
>>> help(ts.concatenate)
Help on function concatenate in module scikits.timeseries.tseries:

concatenate(series, axis=0, remove_duplicates=True, fill_missing=False)
    Joins series together.

    The series are joined in chronological order.
    Duplicated dates are handled with the `remove_duplicates` parameter.
    If `remove_duplicate` is False, duplicated dates are saved.
    Otherwise, only the first occurence of the date is conserved.


    Parameters
    ----------
    series : {sequence}
        Sequence of time series to join
    axis : {0, None, int}, optional
        Axis along which to join
    remove_duplicates : {False, True}, optional
        Whether to remove duplicated dates.
    fill_missing : {False, True}, optional
        Whether to fill the missing dates with missing values.

    Examples
    --------
    >>> a = time_series([1,2,3], start_date=now('D'))
    >>> b = time_series([10,20,30], start_date=now('D')+1)
    >>> c = concatenate((a,b))
    >>> c._series
    masked_array(data = [ 1  2  3 30],
          mask = False,
          fill_value=999999)



More information about the SciPy-user mailing list