About 89,400 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    The previous answers don't discuss multi-dimensional array slicing which is possible using the famous NumPy package: Slicing can also be applied to multi-dimensional arrays.

  2. Python: slicing a multi-dimensional array - Stack Overflow

    Feb 27, 2023 · If not, you can read below. The problem: Multidimensional lists in Python can have inconsistent types or dimensions, making conversion to a NumPy array impossible. For example, the …

  3. Python array slicing -- How can 2D array slicing be implemented ...

    Apr 19, 2013 · I am wondering how 2D array slicing can be implemented in Python? For example, arr is an instance of a self-defined class 2D array. if I want to enable 2D slicing syntax on this object like thi...

  4. How to extract multiple slices in an array? - Stack Overflow

    actually listing in your example is tuple not an array. For array you should use array module, or list as closest concept. Difference between tuples and lists that in first elements are immutable.

  5. How do you use the ellipsis slicing syntax in Python?

    Sep 23, 2008 · This came up in Hidden features of Python, but I can't see good documentation or examples that explain how the feature works.

  6. How to slice a list from an element n to the end in Python?

    How to slice a list from an element n to the end in Python? Asked 16 years, 9 months ago Modified 1 month ago Viewed 202k times

  7. Shortest way to slice even/odd lines from a python array?

    Feb 14, 2011 · 96 Or, a more general question would be, how to slice an array to get every n-th line, so for even/odd you'd want to skip one line, but in the general case you'd want to get every n-th lines, …

  8. list - Python Array Slice With Comma? - Stack Overflow

    Apr 2, 2012 · I was wondering what the use of the comma was when slicing Python arrays - I have an example that appears to work, but the line that looks weird to me is p = …

  9. Slicing a list in Python without generating a copy

    Feb 27, 2011 · Given a list of integers L, I need to generate all of the sublists L[k:] for k in [0, len(L) - 1], without generating copies. How do I accomplish this in Python? With a buffer object somehow?

  10. python - Slice an array to exclude a single element - Stack Overflow

    Jun 9, 2019 · I would like to slice a numpy array so that I can exclude a single element from it. For example, like this: