无法为SparsePandasDataframe

时间:2017-05-22 07:27:23

标签: python-3.x pandas sparse-matrix

无法为SparsePandasDataframe赋值,当我对PandasDataframe执行相同操作时,它可以正常工作。有人能解释一下为什么吗?

data_ibs.iloc[0,2] = 10
  

NotImplementedError Traceback(最新版本   最后打电话)        in()       ----> 1 data_ibs.iloc [0,2] = 10

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py
      setitem 中的

(自我,键,值)           177 key = com._apply_if_callable(key,self.obj)           178 indexer = self._get_setitem_indexer(key)        - > 179 self._setitem_with_indexer(indexer,value)           180           181 def _has_valid_type(self,k,axis):

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py
     _setitem_with_indexer中的

(self,indexer,value)           586#标量           587标签中的项目:        - > 588 setter(项目,值)           589           590其他:

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/indexing.py
     

in setter(item,v)           511 s._consolidate_inplace()           512 s = s.copy()        - > 513 s._data = s._data.setitem(indexer = pi,value = v)           514 s._maybe_update_cacher(clear = True)           515

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/internals.py
     

in setitem(self,** kwargs)          3201          3202 def setitem(self,** kwargs):        - > 3203返回self.apply('setitem',** kwargs)          3204          3205 def putmask(self,** kwargs):

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/internals.py
     

in apply(self,f,axes,filter,do_integrity_check,巩固,   ** kwargs)          3089          3090 kwargs ['mgr'] =自我        - > 3091 applied = getattr(b,f)(** kwargs)          3092 result_blocks = _extend_blocks(applied,result_blocks)          3093

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/internals.py
     setitem中的

(self,indexer,value,mgr)           688           689#将值转换为可以保存nan的类型(如果需要)        - > 690如果不是self._can_hold_element(value):           691 dtype,_ = maybe_promote(arr_value.dtype)           692个值= values.astype(dtype)

/Users/ivanmac/anaconda/lib/python3.6/site-packages/pandas/core/internals.py
     _can_hold_element中的

(自我,值)           547           548 def _can_hold_element(self,value):        - > 549引发NotImplementedError()           550           551 def _try_cast(self,value):

NotImplementedError:

0 个答案:

没有答案