Skip to main content

C++ string vector for Python

Tested against Windows 10 / Python 3.11 / Anaconda / C++ 20 - MSVC

pip install cppvecstring

Cython and a C++ compiler must be installed!

from cppvecstring import CppVectorStr
import numpy as np

with open(r"C:\androidcsvdata.csv",mode='rb') as f:
    mystrings=f.read().splitlines()[:1500]
c=CppVectorStr(mystrings)
print(len(c))
print(c)
del c[0]
print(c)
del c[[0,1,2,3]]
print(c)
print(c.nparray)
resultre1=c.re_finditer(b'samsung')
resultre2=c.re_findall(b'samsung.{1,20}')
resultre3=c.re_match(b'samsung')
resultre4=c.re_fullmatch(b'samsung')
resultre5=c.re_search(b'samsung')
resultre6=c.re_split(b'samsung')
result2=c.find(b'samsung')
result3=c.find_first_not_of(b"abcdefghijklmnopqrstuvwxyz ")
result4=c.find_first_of(b"abcdefghijklmnopqrstuvwxyz ")
result3=c.find_last_not_of(b"abcdefghijklmnopqrstuvwxyz ")
result4=c.find_last_of(b"abcdefghijklmnopqrstuvwxyz ")
c[0]=b'xxxxxxxxxxxxxx'
c[90:98]=b'xxxxxxxxxxxxxx'
print(c[0])
print(b'xxxxxxxxxxxxxx' in c)
c.insert(2,b'yyyyy')
print(b'yyyyy' in c)
print(c.index(b'yyyyy'))
print(c)
print(c[5:10])
resultre1=c.re_finditer(b'samsung',line_to_results=False)
resultre2=c.re_findall(b'samsung.{1,20}',line_to_results=False)
resultre3=c.re_match(b'samsung',line_to_results=False)
resultre4=c.re_fullmatch(b'samsung',line_to_results=False)
resultre5=c.re_search(b'samsung',line_to_results=False)
resultre6=c.re_split(b'samsung',line_to_results=False)
print(c.index_all(b'xxxxxxxxxxxxxx'))
gi=c.group_items()
print(c.pop(1))
spli=c.split_at_index([2, 4, 6, 10])
spli=c.split_at_value(b'xxxxxxxxxxxxxx')
c.extend([b'aaaaaaaaaaa',b'bbbbbbbbbbbbbb'])
c.extend_save([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])
c.extend_save_with_conversion([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])

print(c.count(b'aaaaaaaaaaa'))
print(c.reverse())
cc=(c.copy())
print(cc)
cc.clear()
print(cc)
print(cc.empty())
print(c.to_list())
print(c.to_tuple())
print(c.to_set())

my_results_apply_as_c_function = []
my_results_apply_as_c_pyfunction = []
my_results_apply_as_c_function_nogil = []


def apply_as_c_function(a):
    my_results_apply_as_c_function.append(a.startswith(b'xxx'))


def apply_as_c_pyfunction(a):
    my_results_apply_as_c_pyfunction.append(a.startswith(b'xxx'))


def apply_function(a):
    return a.startswith(b'xxx')


def apply_as_c_function_nogil(a):
    my_results_apply_as_c_function_nogil.append(a.startswith(b'xxx'))  # might not release the gil

results1 = c.apply_function(apply_function)
print(results1)
c.apply_as_c_function(apply_as_c_function)
print(my_results_apply_as_c_function)
c.apply_as_c_pyfunction(apply_as_c_pyfunction)
print(my_results_apply_as_c_pyfunction)
c.apply_as_c_function_nogil(apply_as_c_function_nogil)
print(my_results_apply_as_c_function_nogil)

Metadata

Release files for cppvecstring 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 cppvecstring 0.10
File Size Uploaded Provenance Actions
cppvecstring-0.10.tar.gz 29.5 kB Without provenance Details for cppvecstring-0.10.tar.gz

Built distribution (wheel)

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

Total release size: 59.7 kB

Release files / cppvecstring-0.10.tar.gz

Download URL cppvecstring-0.10.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c79ee2a0edd8125816358e7b714559e4ff4e826d172cbfe63b8938ff9e84b815
BLAKE2b-256 checksum
How to use checksums
deb7e5c8d69284ad80a4988bf89c6b96d1e8b31c321298ae96dc993029372232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

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

Download URL cppvecstring-0.10-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca257cbe71c749a760034054915e9aa8f7e655af989a384e2ef4f394061cd7f7
BLAKE2b-256 checksum
How to use checksums
2a040f6a15d563fc9cd09ff30d5f2c5c86b2ccd585d22ff97e7d684f839f0bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for cppvecstring 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