StringToInt¶
- class torcheeg.transforms.StringToInt[source][source]¶
Identify numbers in strings and convert strings to numbers. If there is no number in the string, the output corresponding to the string is 0.
transform = StringToInt() transform(y='None')['y'] >>> 0 transform = StringToInt() transform(y='sub001')['y'] >>> 1
StringToIntallows converting a list of strings to a list of numbers with the same conversion behavior as a single string.transform = StringToInt() transform(y=['sub001', '4'])['y'] >>> 1, 4