For the latest version of JMP Help, visit JMP.com/help.


Publication date: 07/24/2024

Slice

Use the slice syntax to subset a sequence such as a list, a string, a JMP data table, or a JMP column.

In the following example, a substring is extracted from the given string.

result = "Python in JMP"[2:8]
print(result)

thon i

In this example, slice is used with a jmp.DataTable.Column object to print a stepped subset of that column to the log. This example steps by two, skipping every other cell in the column.

import jmp
 
dt = jmp.open(jmp.SAMPLE_DATA + 'Big Class.jmp')
col = dt['name']
 
print(col[1:9:2])

['LOUISE', 'JACLYN', 'TIM', 'ROBERT']

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).