Skip to main content

simplifies the process of splitting a list of strings at specified character indices

Tested against Windows 10 / Python 3.10 / Anaconda

pip install stringindexsplit

Description:

The SplitStringsAtIndices package is a Python utility that simplifies the process of splitting a list of strings at specified character indices. Whether you're working with text data in data analysis, natural language processing, or text processing tasks, this package provides a handy tool to efficiently split strings and extract substrings based on your requirements.

Key Features:

Flexible Input:

Accepts a variety of input formats, including lists, tuples, and NumPy arrays, making it compatible with different data structures.

Precise Splitting:

Specify the exact character indices at which you want to split your strings, giving you full control over the extraction process.

Efficient Processing:

Utilizes NumPy for efficient array manipulation, ensuring fast and optimized splitting of strings.

2D NumPy Output:

Returns a 2D NumPy array where each row contains the split strings, facilitating further analysis and manipulation. Why Choose SplitStringsAtIndices?

split_list_of_strings_at_indices(
    strings: Union[list, tuple, np.ndarray], splitlist: Union[list, tuple, np.ndarray]
) -> np.ndarray:
r"""
Splits a list of strings at specified character indices.

:param strings: List of strings to be split.
:type strings: Union[list, tuple, np.ndarray]

:param splitlist: List of indices at which to split the strings.
:type splitlist: Union[list, tuple, np.ndarray]

:return: 2D NumPy array where each row contains the split strings.
:rtype: np.ndarray

Example usage:
>>> from stringindexsplit import split_list_of_strings_at_indices
>>> stringlist = '''For most Unix systems, you must download and compile the source code. The same source code archive can also be used to build the Windows and Mac versions, and is the starting point for ports to all other platforms.'''.split()
>>> splist = split_list_of_strings_at_indices(
...     stringlist,
...     splitlist=(
...         0,
...         2,
...         3,
...         6,
...         7,
...     ),
... )
>>> print(splist)

[['Fo' 'r' '' '' '']
 ['mo' 's' 't' '' '']
 ['Un' 'i' 'x' '' '']
 ['sy' 's' 'tem' 's' ',']
 ['yo' 'u' '' '' '']
 ['mu' 's' 't' '' '']
 ['do' 'w' 'nlo' 'a' 'd']
 ['an' 'd' '' '' '']
 ['co' 'm' 'pil' 'e' '']]

Metadata

Release files for stringindexsplit 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stringindexsplit 0.10
File Size Uploaded Provenance Actions
stringindexsplit-0.10.tar.gz 21.2 kB Without provenance Details for stringindexsplit-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stringindexsplit 0.10
File Interpreter ABI Platform Actions
stringindexsplit-0.10-py3-none-any.whl Python 3 none any Details for stringindexsplit-0.10-py3-none-any.whl

Total release size: 43.0 kB

Release files / stringindexsplit-0.10.tar.gz

Download URL stringindexsplit-0.10.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
49c2b2a7461ae5793798b6b099d9a55461f2dceca937673e1fef5767b7509378
BLAKE2b-256 checksum
How to use checksums
047fe84532f2d1ddbec2dbf1d17e5f3adcfaec2aaa8b18994aa7ee45b8989580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / stringindexsplit-0.10-py3-none-any.whl

Download URL stringindexsplit-0.10-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fedd014234386a05676c19c99823f5db99c3c6d6d2ee9c74ed165bec34031b38
BLAKE2b-256 checksum
How to use checksums
8d7010c773418e9a4e24d19de39da4a52292e315e3c0b5e829015e5a1a4cfee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for stringindexsplit 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page