How do I assign a vector to a subset of rows of a column in a pandas DataFrame with NaNs?
Question: i'm having trouble assigning to a DataFrame column for a subset of rows, if
there are NaNs in the DataFrame. i can't tell, is this a bug or am i
misunderstanding something?

first off, if there are no NaNs, what i want appears to work :

    
    
    >>> import pandas as pd
    >>> d = pd.DataFrame({ 'one' : [1, 2, 3], 'two' : [1,2,3] })
    >>> d
       one  two
    0    1    1
    1    2    2
    2    3    3
    >>> d.ix[d['one']>1, 'two'] = -d['two']
    >>> d
       one  two
    0    1    1
    1    2   -2
    2    3   -3
    

however, adding nuisance NaN rows causes non-intuitive results :

    
    
    >>> nan = float('nan')
    >>> d = pd.DataFrame({ 'one' : [1, 2, 3, nan, nan], 'two' : [1,2,3,4,5] })
    >>> d
       one  two
    0    1    1
    1    2    2
    2    3    3
    3  NaN    4
    4  NaN    5
    >>> d.ix[d['one']>1, 'two'] = -d['two']
    >>> d
       one  two
    0    1    1
    1    2   -2
    2    3   -2
    3  NaN    4
    4  NaN    5
    

what is going on here? this is with Python 2.7.5 and pandas 0.11.


Answer: This is a [bug](https://github.com/pydata/pandas/issues/3668) in 0.11 and has
since been fixed in dev (so will be in 0.11.1, out soon).

_Thanks for reporting, this test case~~will be~~ [has been added to
pandas](https://github.com/pydata/pandas/pull/3858) testing suite._

