Top "Slice" questions

A slice is a representation of a part of a sequence, usually defined by a reference to the underlying sequence, an index giving the starting position, a length or end position, and optionally a "stride" or "step" value.

How to slice an array by key, not offset?

PHP function array_slice() returns sequence of elements by offset like this: // sample data $a = array('a','b','c',100=>…

php arrays slice offset array-filter
Get mean of 2D slice of a 3D array in numpy

I have a numpy array with a shape of: (11L, 5L, 5L) I want to calculate the mean over the 25 …

arrays numpy multidimensional-array slice mean
Python plot - stacked image slices

I have a series of basic 2D images (3 for simplicity for now) and these are related to each other, analogous …

python image matplotlib slice stacked
Golang create a slice of maps

I was trying to create a slice of maps the following way. keyvalue := make(map[string]interface{}) keyvalueslice := make([]keyvalue, 1, 1) …

dictionary go hashmap slice key-value
Slice notation in Scala?

Is there something similar to the slice notation in Python in Scala? I think this is really a useful operation …

python scala slice
R array manipulation

In python lists can be sliced like this x[4:-1] to get from the fourth to the last element. In …

arrays r slice sub-array
How can I slice a string in C?

I need to find if a char array starts with "ADD". I know to use strcmp(), but I don't know …

c string cstring slice
Iterate through a List Multiple times Cyclically starting from the Matching Index

I need to do the following in python. I have a list of strings, list, a string to search for, …

python list iterator cycle slice
Performance about replace() or substr() in Javascript

I was wondering about Javascript performance about using string.replace() or string.substr(). Let me explain what I'm doing. I've …

javascript regex replace slice substr
slicing sparse (scipy) matrix

I would appreciate any help, to understand following behavior when slicing a lil_matrix (A) from the scipy.sparse package. …

python scipy slice sparse-matrix submatrix