[SciPy-User] usemask kwd in timeseries.tsfromtxt missing?

Skipper Seabold jsseabold@gmail....
Sat Mar 13 10:43:42 CST 2010


On Sat, Mar 13, 2010 at 3:55 AM, Tim Michelsen
<timmichelsen@gmx-topmail.de> wrote:
>> The docs say that usemask is a kwd arg, but it's not implemented.  Is
>> this an oversight or are the docs wrong and the TimeSeries object must
>> be a masked array?
> do you have masked data?
>
> I suggest to omit the argument.
>
> To my experience:
> If you load data with missing values (missing_values) a masked array is
> created automatically. If not, the array will be regular.
>

from StringIO import StringIO
import scikits.timeseries as ts
s = '"dates","GDP","CONS","INV","GOVT"\n"1947-I",100.2,33.4,33.4,33.4\n"1947-II",100.2,33.4,33.4,33.4'
s = StringIO(s)

romans = {"I":1,"II":2,"III":3,"IV":4}
dateconverter = lambda x: ts.Date(freq='Q',
year=int(x.split("-")[0].strip("\"")),
quarter=romans[x.split("-")[1].strip("\"")])

data = ts.tsfromtxt(s, delimiter=",", dtype=None,
dateconverter=dateconverter, names=True, usemask=True)
#TypeError: tsfromtxt() got an unexpected keyword argument 'usemask'

data = ts.tsfromtxt(s, delimiter=",", dtype=None,
dateconverter=dateconverter, names=True)
hasattr(data,'mask')
# True

print ts.tsfromtxt.__doc__
<snip>
    usemask : bool, optional
        If True, return a masked array.
        If False, return a regular array.
<snip>

Skipper


More information about the SciPy-User mailing list