[SciPy-Dev] Unexpected behaviour from timeseries.filled (in Python 2.7)

Pierre GM pgmdevlist@gmail....
Mon Sep 6 13:45:56 CDT 2010

On Sep 6, 2010, at 7:37 PM, Åsmund Hjulstad wrote:

> 2010/9/6 Pierre GM <pgmdevlist@gmail.com>:
>> On Sep 6, 2010, at 5:32 PM, Åsmund Hjulstad wrote:
>>> After some debugging, I found out the following:
>>> the TimeSeries.filled() method does this:
>>> result = self._series.filled(fill_value=fill_value).view(type(self))
>>> somehow, the _series view does not retain the fill value.
>>> replacing this with (around line 1217 in tseries.py)
>>> result = MaskedArray.filled(self,fill_value=fill_value).view(type(self))
>>> things work better (for me, at least)
>> Åsmund,
>> Glad you were able to figure it out by yourself (and showing me where th pb was).
>> Nevertheless, do you mind opening a ticket ? I have quite a few to process first, and I don't want this one to fall between the cracks.
>> Thanks a lot in advance.
> I will, one question though: Why does MaskedArray reset the fill_value
> when creating a view?  

It does, but it shouldn't. 

> This, appearantly, is what happens when the
> self._series property is accessed. Isn't it more reasonable to
> preserve it? I haven't been able to pinpoint what exactly caused the
> behaviour to change, whether it was the Numpy 1.3 -> 1.5 change or the
> Python 2.6 -> 2.7   (I would guess the former, though.)

Probably the former indeed. OK, I'll be on that.
Thx for the report !

More information about the SciPy-Dev mailing list