vastorbit.VastColumn.str_contains¶
- VastColumn.str_contains(pat: str) VastFrame¶
Verifies if the regular expression is in each of the VastColumn records. The VastColumn will be transformed.
- Parameters:
pat (str) – Regular expression.
- Returns:
self._parent
- Return type:
Examples
Let’s begin by importing vastorbit.
import vastorbit as vo
Let’s generate a small dataset using the following data:
data = vo.VastFrame( { "rollno": ['1', '2', '3', '4'], "subjects": [ 'English, Math', 'English, Math, Computer', 'Math, Computer, Science', 'Math, Science', ], } )
Let’s check if subjects contain “English”.
data["subjects"].str_contains(pat = "English").select( [ "rollno", "subjects as has_english", ] )
AbcrollnoVarchar(1)0|1has_englishBoolean1 4 ✗ 2 1 ✓ 3 2 ✓ 4 3 ✗ Rows: 1-4 | Columns: 2See also
VastFrame.str_count(): Counts occurrences matching the regular expression.VastFrame.str_extract(): Extracts the Regular Expression.VastFrame.str_replace(): Replaces the Regular Expression.VastFrame.str_slice(): Slices the Regular Expression.