Beispiel #1
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     if isinstance(index, slice):
         for i, entry in enumerate(self._list[index]):
             setattr(entry, self._attr, value)
     else:
         setattr(self._list[index], self._attr, value)
Beispiel #2
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     if isinstance(index, slice):
         for i, entry in enumerate(self._list[index]):
             setattr(entry, self._attr, value)
     else:
         setattr(self._list[index], self._attr, value)
 def __setitem__( a_, i, x ):
     "a_[i] = x"
     try:
         for j, xj in zip( range( * i.indices(len(a_)) ), x ):
             a_[j] = xj
         return
     except:
         if isinstance( i, slice ): raise
     try:
         for j in range( * i.indices(len(a_)) ):
             a_[j] = x
         return
     except: pass
     try:
         for j, xj in zip( i, x ):
             a_[j] = xj
         return
     except: pass
     try:
         for j in i:
             a_[i] = x
         return
     except:
         pass
     ndarray.__setitem__( a_, i, x )
     coords = a_.allcoords[i]
     e = a_.base
     for j in coords[:-1]: e = e[j]
     e[coords[-1]] = x
Beispiel #4
0
 def __setslice__(self, i, j, value):
     ndarray.__setitem__(self, slice(i, j), value)
     if j == maxsize:
         j = len(self)
     if hasattr(value, "__getitem__"):  # setting to a list
         for index in range(i, j):
             setattr(self._list[index], self._attr, value[index])
     else:
         for index in range(i, j):
             setattr(self._list[index], self._attr, value)
Beispiel #5
0
 def __setslice__(self, i, j, value):
     ndarray.__setitem__(self, slice(i, j), value)
     if j == maxsize:
         j = len(self)
     if hasattr(value, "__getitem__"):  # setting to a list
         for index in range(i, j):
             setattr(self._list[index], self._attr, value[index])
     else:
         for index in range(i, j):
             setattr(self._list[index], self._attr, value)
Beispiel #6
0
 def __setitem__(self, key, value):
     """
     If this series is mutable, set specified indices equal to given values.
     """
     try:
         loc = self.index.indexMap[key]
         ndarray.__setitem__(self, loc, value)
     except Exception:
         values = self.values
         values[key] = value
Beispiel #7
0
 def __setitem__(self, key, value):
     """
     If this series is mutable, set specified indices equal to given values.
     """
     try:
         loc = self.index.indexMap[key]
         ndarray.__setitem__(self, loc, value)
     except Exception:
         values = self.values
         values[key] = value
Beispiel #8
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     if isinstance(index, slice):
         # not sure why that is here
         if index.stop == maxsize:
             index = slice(index.start, len(self))
         if hasattr(value, "__getitem__"):
             for i, entry in enumerate(self._list[index]):
                 setattr(entry, self._attr, value[i])
         else:
             for i, entry in enumerate(self._list[index]):
                 setattr(entry, self._attr, value)
     else:
         setattr(self._list[index], self._attr, value)
Beispiel #9
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     if isinstance(index, slice):
         # not sure why that is here
         if index.stop == maxsize:
             index = slice(index.start, len(self))
         if hasattr(value, "__getitem__"):
             for i, entry in enumerate(self._list[index]):
                 setattr(entry, self._attr, value[i])
         else:
             for i, entry in enumerate(self._list[index]):
                 setattr(entry, self._attr, value)
     else:
         setattr(self._list[index], self._attr, value)
Beispiel #10
0
 def _extend(self, other):
     old_size = len(self)
     new_size = old_size + len(other)
     self.resize(new_size, refcheck=False)
     ndarray.__setitem__(self, slice(old_size, new_size), other)
Beispiel #11
0
 def __setitem__(self, ind, val):
   nInd = self._interpretIndexes(ind)
   return ndarray.__setitem__(self, nInd, val)
Beispiel #12
0
 def __setitem__(self, ind, val):
     nInd = self._interpretIndexes(ind)
     return ndarray.__setitem__(self, nInd, val)
Beispiel #13
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     setattr(self._list[index], self._attr, value)
Beispiel #14
0
 def replace(self, item, new_container, i):
     ndarray.__setitem__(self.ravel(), i, new_container)
Beispiel #15
0
 def _extend(self, other):
     old_size = len(self)
     new_size = old_size + len(other)
     self.resize(new_size, refcheck=False)
     ndarray.__setitem__(self, slice(old_size, new_size), other)
Beispiel #16
0
 def replace(self, item, new_container, i):
     ndarray.__setitem__(self.ravel(), i, new_container)
Beispiel #17
0
 def __setitem__(self, index, value):
     ndarray.__setitem__(self, index, value)
     setattr(self._list[index], self._attr, value)