Detail: Batch: Accessor String

Overview: Batch: Accessor String

Batch.via_str.__getitem__(key)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.__getitem__(key)[source]

Return a container with the provided selection or slice of each element.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str[-1].to_frame()
<Frame>
<Index>                   a     b     c        <<U1>
<IndexHierarchy>
i                0        0           1
i                1        2     Z     1
i                2        8     3     1
i                3        3           0
j                p        0           nan
j                q        2     Z     nan
j                r        8     3     nan
j                s        3           nan
<<U1>            <object> <<U1> <<U1> <object>
Batch.via_str.capitalize
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.capitalize()[source]

Return a container with only the first character of each element capitalized.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.capitalize().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     Qrs   1517-01-01
i                1        2      Xyz   1517-04-01
i                2        8      123   1517-12-31
i                3        3       wx   1517-06-30
j                p        10     Qrs   nan
j                q        2      Xyz   nan
j                r        8      123   nan
j                s        3       wx   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.center(width, fillchar)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.center(width, fillchar=' ')[source]

Return a container with its elements centered in a string of length width.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.center(8).to_frame()
<Frame>
<Index>                   a        b        c        <<U1>
<IndexHierarchy>
i                0           10      qrs    1517-01-
i                1           2       XYZ    1517-04-
i                2           8       123    1517-12-
i                3           3        wX    1517-06-
j                p           10      qrs    nan
j                q           2       XYZ    nan
j                r           8       123    nan
j                s           3        wX    nan
<<U1>            <object> <<U8>    <<U8>    <object>
Batch.via_str.contains(item)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.contains(item)[source]

Returns a container with the number of non-overlapping occurrences of substring sub in the optional range start, end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.contains('X').to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  True   False
i                2        False  False  False
i                3        False  True   False
j                p        False  False  nan
j                q        False  True   nan
j                r        False  False  nan
j                s        False  True   nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.count(sub, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.count(sub, start=None, end=None)[source]

Returns a container with the number of non-overlapping occurrences of substring sub in the optional range start, end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.count('X').to_frame()
<Frame>
<Index>                   a       b       c         <<U1>
<IndexHierarchy>
i                0        0       0       0.0
i                1        0       1       0.0
i                2        0       0       0.0
i                3        0       1       0.0
j                p        0       0       nan
j                q        0       1       nan
j                r        0       0       nan
j                s        0       1       nan
<<U1>            <object> <int64> <int64> <float64>
Batch.via_str.decode(encoding, errors)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.decode(encoding=None, errors=None)[source]

Apply str.decode() to each element. Elements must be bytes.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x')))).astype(bytes)
>>> bt
<Batch max_workers=None>
>>> bt.via_str.decode().to_frame()
<Frame>
<Index>                   a     b     c          <<U1>
<IndexHierarchy>
i                0        10    qrs   1517-01-01
i                1        2     XYZ   1517-04-01
i                2        8     123   1517-12-31
i                3        3      wX   1517-06-30
j                p        10    qrs   nan
j                q        2     XYZ   nan
j                r        8     123   nan
j                s        3      wX   nan
<<U1>            <object> <<U2> <<U4> <object>
Batch.via_str.encode(encoding, errors)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.encode(encoding=None, errors=None)[source]

Apply str.encode() to each element. Elements must be strings.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.encode().to_frame()
<Frame>
<Index>                   a     b       c             <<U1>
<IndexHierarchy>
i                0        b'10' b'qrs ' b'1517-01-01'
i                1        b'2'  b'XYZ'  b'1517-04-01'
i                2        b'8'  b'123'  b'1517-12-31'
i                3        b'3'  b' wX ' b'1517-06-30'
j                p        b'10' b'qrs ' nan
j                q        b'2'  b'XYZ'  nan
j                r        b'8'  b'123'  nan
j                s        b'3'  b' wX ' nan
<<U1>            <object> <|S2> <|S4>   <object>
Batch.via_str.endswith(suffix, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.endswith(suffix, start=None, end=None)[source]

Returns a container with the number of non-overlapping occurrences of substring suffix (or an interable of suffixes) in the optional range start, end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.endswith(' ').to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  True   False
i                1        False  False  False
i                2        False  False  False
i                3        False  True   False
j                p        False  True   nan
j                q        False  False  nan
j                r        False  False  nan
j                s        False  True   nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.find(sub, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.find(sub, start=None, end=None)[source]

For each element, return the lowest index in the string where substring sub is found.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.find('X').to_frame()
<Frame>
<Index>                   a       b       c         <<U1>
<IndexHierarchy>
i                0        -1      -1      -1.0
i                1        -1      0       -1.0
i                2        -1      -1      -1.0
i                3        -1      2       -1.0
j                p        -1      -1      nan
j                q        -1      0       nan
j                r        -1      -1      nan
j                s        -1      2       nan
<<U1>            <object> <int64> <int64> <float64>
Batch.via_str.format(format)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.format(format)[source]

For each element, return a string resulting from calling the format argument’s format method with the values in this container.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.format('{:-^10}').to_frame()
<Frame>
<Index>                   a          b          c          <<U1>
<IndexHierarchy>
i                0        ----10---- ---qrs --- 1517-01-01
i                1        ----2----- ---XYZ---- 1517-04-01
i                2        ----8----- ---123---- 1517-12-31
i                3        ----3----- --- wX --- 1517-06-30
j                p        ----10---- ---qrs --- nan
j                q        ----2----- ---XYZ---- nan
j                r        ----8----- ---123---- nan
j                s        ----3----- --- wX --- nan
<<U1>            <object> <<U10>     <<U10>     <object>
Batch.via_str.index(sub, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.index(sub, start=None, end=None)[source]

Like find, but raises ValueError when the substring is not found.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.index('X').to_frame()
ValueError('substring not found')
Batch.via_str.isalnum
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isalnum()[source]

Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isalnum().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        True   False  False
i                1        True   True   False
i                2        True   True   False
i                3        True   False  False
j                p        True   False  nan
j                q        True   True   nan
j                r        True   True   nan
j                s        True   False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isalpha
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isalpha()[source]

Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isalpha().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  True   False
i                2        False  False  False
i                3        False  False  False
j                p        False  False  nan
j                q        False  True   nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isdecimal
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isdecimal()[source]

For each element, return True if there are only decimal characters in the element.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isdecimal().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        True   False  False
i                1        True   False  False
i                2        True   True   False
i                3        True   False  False
j                p        True   False  nan
j                q        True   False  nan
j                r        True   True   nan
j                s        True   False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isdigit
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isdigit()[source]

Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isdigit().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        True   False  False
i                1        True   False  False
i                2        True   True   False
i                3        True   False  False
j                p        True   False  nan
j                q        True   False  nan
j                r        True   True   nan
j                s        True   False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.islower
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.islower()[source]

Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.islower().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  True   False
i                1        False  False  False
i                2        False  False  False
i                3        False  False  False
j                p        False  True   nan
j                q        False  False  nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isnumeric
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isnumeric()[source]

For each element in self, return True if there are only numeric characters in the element.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isnumeric().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        True   False  False
i                1        True   False  False
i                2        True   True   False
i                3        True   False  False
j                p        True   False  nan
j                q        True   False  nan
j                r        True   True   nan
j                s        True   False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isspace
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isspace()[source]

Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isspace().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  False  False
i                2        False  False  False
i                3        False  False  False
j                p        False  False  nan
j                q        False  False  nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.istitle
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.istitle()[source]

Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.istitle().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  False  False
i                2        False  False  False
i                3        False  False  False
j                p        False  False  nan
j                q        False  False  nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.isupper
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.isupper()[source]

Returns true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.isupper().to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  True   False
i                2        False  False  False
i                3        False  False  False
j                p        False  False  nan
j                q        False  True   nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.ljust(width, fillchar)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.ljust(width, fillchar=' ')[source]

Return a container with its elements ljusted in a string of length width.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.ljust(8).to_frame()
<Frame>
<Index>                   a        b        c        <<U1>
<IndexHierarchy>
i                0        10       qrs      1517-01-
i                1        2        XYZ      1517-04-
i                2        8        123      1517-12-
i                3        3         wX      1517-06-
j                p        10       qrs      nan
j                q        2        XYZ      nan
j                r        8        123      nan
j                s        3         wX      nan
<<U1>            <object> <<U8>    <<U8>    <object>
Batch.via_str.len
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.len()[source]

Return the length of the string.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.len().to_frame()
<Frame>
<Index>                   a       b       c         <<U1>
<IndexHierarchy>
i                0        2       4       10.0
i                1        1       3       10.0
i                2        1       3       10.0
i                3        1       4       10.0
j                p        2       4       nan
j                q        1       3       nan
j                r        1       3       nan
j                s        1       4       nan
<<U1>            <object> <int64> <int64> <float64>
Batch.via_str.lower
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.lower()[source]

Return an array with the elements of self converted to lowercase.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.lower().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     qrs   1517-01-01
i                1        2      xyz   1517-04-01
i                2        8      123   1517-12-31
i                3        3       wx   1517-06-30
j                p        10     qrs   nan
j                q        2      xyz   nan
j                r        8      123   nan
j                s        3       wx   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.lstrip(chars)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.lstrip(chars=None)[source]

For each element, return a copy with the leading characters removed.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.lstrip().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     qrs   1517-01-01
i                1        2      XYZ   1517-04-01
i                2        8      123   1517-12-31
i                3        3      wX    1517-06-30
j                p        10     qrs   nan
j                q        2      XYZ   nan
j                r        8      123   nan
j                s        3      wX    nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.partition(sep)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.partition(sep)[source]

Partition each element around sep.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.partition('X').to_frame()
<Frame>
<Index>                   a              b                c                    <<U1>
<IndexHierarchy>
i                0        ('10', '', '') ('qrs ', '', '') ('1517-01-01', ''...
i                1        ('2', '', '')  ('', 'X', 'YZ')  ('1517-04-01', ''...
i                2        ('8', '', '')  ('123', '', '')  ('1517-12-31', ''...
i                3        ('3', '', '')  (' w', 'X', ' ') ('1517-06-30', ''...
j                p        ('10', '', '') ('qrs ', '', '') nan
j                q        ('2', '', '')  ('', 'X', 'YZ')  nan
j                r        ('8', '', '')  ('123', '', '')  nan
j                s        ('3', '', '')  (' w', 'X', ' ') nan
<<U1>            <object> <object>       <object>         <object>
Batch.via_str.replace(old, new, count)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.replace(old, new, count=None)[source]

Return a container with its elements replaced in a string of length width.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.replace('X', '*').to_frame()
<Frame>
<Index>                   a     b     c          <<U1>
<IndexHierarchy>
i                0        10    qrs   1517-01-01
i                1        2     *YZ   1517-04-01
i                2        8     123   1517-12-31
i                3        3      w*   1517-06-30
j                p        10    qrs   nan
j                q        2     *YZ   nan
j                r        8     123   nan
j                s        3      w*   nan
<<U1>            <object> <<U2> <<U4> <object>
Batch.via_str.rfind(sub, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rfind(sub, start=None, end=None)[source]

For each element, return the highest index in the string where substring sub is found, such that sub is contained within start, end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rfind('X').to_frame()
<Frame>
<Index>                   a       b       c         <<U1>
<IndexHierarchy>
i                0        -1      -1      -1.0
i                1        -1      0       -1.0
i                2        -1      -1      -1.0
i                3        -1      2       -1.0
j                p        -1      -1      nan
j                q        -1      0       nan
j                r        -1      -1      nan
j                s        -1      2       nan
<<U1>            <object> <int64> <int64> <float64>
Batch.via_str.rindex(sub, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rindex(sub, start=None, end=None)[source]

Like rfind, but raises ValueError when the substring sub is not found.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rindex('X').to_frame()
ValueError('substring not found')
Batch.via_str.rjust(width, fillchar)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rjust(width, fillchar=' ')[source]

Return a container with its elements rjusted in a string of length width.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rjust(8).to_frame()
<Frame>
<Index>                   a        b        c        <<U1>
<IndexHierarchy>
i                0              10     qrs  1517-01-
i                1               2      XYZ 1517-04-
i                2               8      123 1517-12-
i                3               3      wX  1517-06-
j                p              10     qrs  nan
j                q               2      XYZ nan
j                r               8      123 nan
j                s               3      wX  nan
<<U1>            <object> <<U8>    <<U8>    <object>
Batch.via_str.rpartition(sep)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rpartition(sep)[source]

Partition (split) each element around the right-most separator.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rpartition('X').to_frame()
<Frame>
<Index>                   a              b                c                    <<U1>
<IndexHierarchy>
i                0        ('', '', '10') ('', '', 'qrs ') ('', '', '1517-01...
i                1        ('', '', '2')  ('', 'X', 'YZ')  ('', '', '1517-04...
i                2        ('', '', '8')  ('', '', '123')  ('', '', '1517-12...
i                3        ('', '', '3')  (' w', 'X', ' ') ('', '', '1517-06...
j                p        ('', '', '10') ('', '', 'qrs ') nan
j                q        ('', '', '2')  ('', 'X', 'YZ')  nan
j                r        ('', '', '8')  ('', '', '123')  nan
j                s        ('', '', '3')  (' w', 'X', ' ') nan
<<U1>            <object> <object>       <object>         <object>
Batch.via_str.rsplit(sep, maxsplit)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rsplit(sep, maxsplit=- 1)[source]

For each element, return a tuple of the words in the string, using sep as the delimiter string.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rsplit('X').to_frame()
<Frame>
<Index>                   a        b           c               <<U1>
<IndexHierarchy>
i                0        ('10',)  ('qrs ',)   ('1517-01-01',)
i                1        ('2',)   ('', 'YZ')  ('1517-04-01',)
i                2        ('8',)   ('123',)    ('1517-12-31',)
i                3        ('3',)   (' w', ' ') ('1517-06-30',)
j                p        ('10',)  ('qrs ',)   nan
j                q        ('2',)   ('', 'YZ')  nan
j                r        ('8',)   ('123',)    nan
j                s        ('3',)   (' w', ' ') nan
<<U1>            <object> <object> <object>    <object>
Batch.via_str.rstrip(chars)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.rstrip(chars=None)[source]

For each element, return a copy with the trailing characters removed.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.rstrip().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     qrs   1517-01-01
i                1        2      XYZ   1517-04-01
i                2        8      123   1517-12-31
i                3        3       wX   1517-06-30
j                p        10     qrs   nan
j                q        2      XYZ   nan
j                r        8      123   nan
j                s        3       wX   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.split(sep, maxsplit)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.split(sep, maxsplit=- 1)[source]

For each element, return a tuple of the words in the string, using sep as the delimiter string.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.split('X').to_frame()
<Frame>
<Index>                   a        b           c               <<U1>
<IndexHierarchy>
i                0        ('10',)  ('qrs ',)   ('1517-01-01',)
i                1        ('2',)   ('', 'YZ')  ('1517-04-01',)
i                2        ('8',)   ('123',)    ('1517-12-31',)
i                3        ('3',)   (' w', ' ') ('1517-06-30',)
j                p        ('10',)  ('qrs ',)   nan
j                q        ('2',)   ('', 'YZ')  nan
j                r        ('8',)   ('123',)    nan
j                s        ('3',)   (' w', ' ') nan
<<U1>            <object> <object> <object>    <object>
Batch.via_str.startswith(prefix, start, end)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.startswith(prefix, start=None, end=None)[source]

Returns a container with the number of non-overlapping occurrences of substring prefix (or an interable of prefixes) in the optional range start, end.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.startswith('X').to_frame()
<Frame>
<Index>                   a      b      c        <<U1>
<IndexHierarchy>
i                0        False  False  False
i                1        False  True   False
i                2        False  False  False
i                3        False  False  False
j                p        False  False  nan
j                q        False  True   nan
j                r        False  False  nan
j                s        False  False  nan
<<U1>            <object> <bool> <bool> <object>
Batch.via_str.strip(chars)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.strip(chars=None)[source]

For each element, return a copy with the leading and trailing characters removed.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.strip().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     qrs   1517-01-01
i                1        2      XYZ   1517-04-01
i                2        8      123   1517-12-31
i                3        3      wX    1517-06-30
j                p        10     qrs   nan
j                q        2      XYZ   nan
j                r        8      123   nan
j                s        3      wX    nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.swapcase
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.swapcase()[source]

Return a container with uppercase characters converted to lowercase and vice versa.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.swapcase().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     QRS   1517-01-01
i                1        2      xyz   1517-04-01
i                2        8      123   1517-12-31
i                3        3       Wx   1517-06-30
j                p        10     QRS   nan
j                q        2      xyz   nan
j                r        8      123   nan
j                s        3       Wx   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.title
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.title()[source]

Return a container with uppercase characters converted to lowercase and vice versa.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.title().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     Qrs   1517-01-01
i                1        2      Xyz   1517-04-01
i                2        8      123   1517-12-31
i                3        3       Wx   1517-06-30
j                p        10     Qrs   nan
j                q        2      Xyz   nan
j                r        8      123   nan
j                s        3       Wx   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.upper
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.upper()[source]

Return a container with uppercase characters converted to lowercase and vice versa.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.upper().to_frame()
<Frame>
<Index>                   a      b     c          <<U1>
<IndexHierarchy>
i                0        10     QRS   1517-01-01
i                1        2      XYZ   1517-04-01
i                2        8      123   1517-12-31
i                3        3       WX   1517-06-30
j                p        10     QRS   nan
j                q        2      XYZ   nan
j                r        8      123   nan
j                s        3       WX   nan
<<U1>            <object> <<U21> <<U4> <object>
Batch.via_str.zfill(width)
Batch.via_str

Interface for applying string methods to elements in this container.

InterfaceBatchString.zfill(width)[source]

Return the string left-filled with zeros.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX '), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')), ('j', sf.Frame.from_fields(((10, 2, 8, 3), ('qrs ', 'XYZ', '123', ' wX ')), columns=('a', 'b'), index=('p', 'q', 'r', 's'), name='x'))))
>>> bt
<Batch max_workers=None>
>>> bt.via_str.zfill(8).to_frame()
<Frame>
<Index>                   a        b        c        <<U1>
<IndexHierarchy>
i                0        00000010 0000qrs  1517-01-
i                1        00000002 00000XYZ 1517-04-
i                2        00000008 00000123 1517-12-
i                3        00000003 0000 wX  1517-06-
j                p        00000010 0000qrs  nan
j                q        00000002 00000XYZ nan
j                r        00000008 00000123 nan
j                s        00000003 0000 wX  nan
<<U1>            <object> <<U8>    <<U8>    <object>

Batch: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib