Coder Social home page Coder Social logo

Comments (3)

davidwendt avatar davidwendt commented on June 16, 2024

This is great feedback. So there is a little trick here using device memory to hold the results from contains() where the None value is turned identified as -1 as so can be ignored/counted:

>>> import nvstrings
>>> import numpy as np
>>> from numba import cuda
>>>
>>> a = nvstrings.to_device(["test #woot","strings are awesome","#hashme",None,""])
>>> a.count('\#')
[1, 0, 1, None, 0]

>>> arr = np.arange(a.size(),dtype=np.int32)
>>> d_arr = cuda.to_device(arr)
>>> a.count('\#',d_arr.device_ctypes_pointer.value)

>>> d_arr.copy_to_host()
array([ 1,  0,  1, -1,  0], dtype=int32)

>>> c = d_arr.copy_to_host().tolist()
>>> c.count(0)
2
>>> c.count(-1)
1

The -1 is a place holder identifying None strings for contains() in this case.

from nvstrings.

davidwendt avatar davidwendt commented on June 16, 2024

In the next release of nvstrings, we are adding a couple more parameters to the from_csv method including a set of flags. This will include a flag to treat nulls as empty strings. Also, the next release should include some documentation on from_csv

from nvstrings.

davidwendt avatar davidwendt commented on June 16, 2024

Parameter added in new 0.2.0 release.

from nvstrings.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.