NotImplementedError: fill_value 0 is not supported

I'm relatively new to Python and I'm stuck at this point

frame = DataFrame(np.arange(12.).reshape((4, 3)), columns=list('bde'),
index=['Utah', 'Ohio', 'Texas', 'Oregon'])
series = frame.iloc[:,0]
frame.sub(series, axis = 1,fill_value=0)

throws this error, C: \ Anaconda \ lib \ site-packages \ pandas \ core \ frame.pyc in _ combine_column_matches (self, other, func, level, fill_value) 3470 if fill_value is not None: 3471 raise NotImplementedError ("fill_value % r is not supported "% → 3472 fill_value) 3473 3474 new_data = left._data.eval (

NotImplementedError: fill_value 0 not supported

But in the documentation of the Dataframe.submethod, the fill_valueparameter is supported.

Can someone explain this error?

+4
source share
1 answer

. , sub() , , fill_value - , .

, :

frame.sub(series, axis = 1)
Out[194]: 
        Ohio  Oregon  Texas  Utah   b   d   e
Utah     NaN     NaN    NaN   NaN NaN NaN NaN
Ohio     NaN     NaN    NaN   NaN NaN NaN NaN
Texas    NaN     NaN    NaN   NaN NaN NaN NaN
Oregon   NaN     NaN    NaN   NaN NaN NaN NaN

, . , series, , "b":

series.name
Out[197]: 'b'

, , "b" "b" . , , , @AntonProtopopv, 'b'.

frame.sub(series.to_frame(), axis = 1)
Out[195]: 
          b   d   e
Utah    0.0 NaN NaN
Ohio    0.0 NaN NaN
Texas   0.0 NaN NaN
Oregon  0.0 NaN NaN

, , , , fill_value . , , , , fillna , @NickilMaveli, (, , ) .

: ( 'b' ), , , .

frame.values - series.values.reshape(4,1)
Out[204]: 
array([[0., 1., 2.],
       [0., 1., 2.],
       [0., 1., 2.],
       [0., 1., 2.]])
0

All Articles