Detail: SeriesHE: Assignment

Overview: SeriesHE: Assignment

SeriesHE.assign[key](value, *, fill_value)
assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.__call__(value, *, fill_value=nan)[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters:
  • value – Value to assign, which can be a Series, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign['c']('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          34
e          54
<<U1>      <object>
>>> s.assign['c':]('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          x
e          x
<<U1>      <object>
>>> s.assign[['a', 'd']](('x', 'y'))
<SeriesHE>
<Index>
a          x
b          8
c          19
d          y
e          54
<<U1>      <object>
SeriesHE.assign[key].apply(func, *, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply(func, *, fill_value=nan)[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign['c':].apply(lambda s: s / 100)
<SeriesHE>
<Index>
a          2.0
b          8.0
c          0.19
d          0.34
e          0.54
<<U1>      <float64>
SeriesHE.assign[key].apply_element(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element(func, *, dtype=None, fill_value=nan)[source]

Provide a function to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign['b':].apply_element(lambda e: e if e < 10 else f'--{e}--')
<SeriesHE>
<Index>
a          2
b          8
c          --19--
d          --34--
e          --54--
<<U1>      <object>
SeriesHE.assign[key].apply_element_items(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element_items(func, *, dtype=None, fill_value=nan)[source]

Provide a function, taking pairs of label, element, to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function, taking pairs of label, element, to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign['b':].apply_element_items(lambda l, e: e if l == 'c' else f'--{e}--')
<SeriesHE>
<Index>
a          2
b          --8--
c          19
d          --34--
e          --54--
<<U1>      <object>
SeriesHE.assign.iloc[key](value, *, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.__call__(value, *, fill_value=nan)[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters:
  • value – Value to assign, which can be a Series, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.iloc[2]('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          34
e          54
<<U1>      <object>
>>> s.assign.iloc[2:]('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          x
e          x
<<U1>      <object>
>>> s.assign.iloc[[0, 4]](('x', 'y'))
<SeriesHE>
<Index>
a          x
b          8
c          19
d          34
e          y
<<U1>      <object>
SeriesHE.assign.iloc[key].apply(func, *, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply(func, *, fill_value=nan)[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.iloc[2:].apply(lambda s: s / 100)
<SeriesHE>
<Index>
a          2.0
b          8.0
c          0.19
d          0.34
e          0.54
<<U1>      <float64>
SeriesHE.assign.iloc[key].apply_element(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element(func, *, dtype=None, fill_value=nan)[source]

Provide a function to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.iloc[2:].apply_element(lambda e: e / 100 if e < 10 else e)
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
SeriesHE.assign.iloc[key].apply_element_items(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element_items(func, *, dtype=None, fill_value=nan)[source]

Provide a function, taking pairs of label, element, to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function, taking pairs of label, element, to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.iloc[2:].apply_element_items(lambda l, e: e if l == 'c' else f'--{e}--')
<SeriesHE>
<Index>
a          2
b          8
c          19
d          --34--
e          --54--
<<U1>      <object>
SeriesHE.assign.loc[key](value, *, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.__call__(value, *, fill_value=nan)[source]

Assign the value in the position specified by the selector. The name attribute is propagated to the returned container.

Parameters:
  • value – Value to assign, which can be a Series, np.ndarray, or element.

  • *.

  • fill_value – If the value parameter has to be reindexed, this element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.loc['c']('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          34
e          54
<<U1>      <object>
>>> s.assign.loc['c':]('x')
<SeriesHE>
<Index>
a          2
b          8
c          x
d          x
e          x
<<U1>      <object>
>>> s.assign.loc[['a', 'd']](('x', 'y'))
<SeriesHE>
<Index>
a          x
b          8
c          19
d          y
e          54
<<U1>      <object>
SeriesHE.assign.loc[key].apply(func, *, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply(func, *, fill_value=nan)[source]

Provide a function to apply to the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *.

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.loc['c':].apply(lambda s: s / 100)
<SeriesHE>
<Index>
a          2.0
b          8.0
c          0.19
d          0.34
e          0.54
<<U1>      <float64>
SeriesHE.assign.loc[key].apply_element(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element(func, *, dtype=None, fill_value=nan)[source]

Provide a function to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.loc['c':].apply_element(lambda e: e / 100 if e < 10 else e)
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
SeriesHE.assign.loc[key].apply_element_items(func, *, dtype, fill_value)
SeriesHE.assign

Interface for doing assignment-like selection and replacement.

SeriesAssign.apply_element_items(func, *, dtype=None, fill_value=nan)[source]

Provide a function, taking pairs of label, element, to apply to each element in the assignment target, and use that as the assignment value.

Parameters:
  • func – A function, taking pairs of label, element, to apply to the assignment target.

  • *

  • fill_value – If the function does not produce a container with a matching index, the element will be used to fill newly created elements.

>>> s = sf.SeriesHE((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e'))
>>> s
<SeriesHE>
<Index>
a          2
b          8
c          19
d          34
e          54
<<U1>      <int64>
>>> s.assign.loc['c':].apply_element_items(lambda l, e: e / 100 if l == 'c' else e)
<SeriesHE>
<Index>
a          2.0
b          8.0
c          0.19
d          34.0
e          54.0
<<U1>      <float64>

SeriesHE: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic