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

    Out[145]: [] How Python Figures Out Missing Parameters: When slicing, if you leave out any parameter, Python tries to figure it out automatically. If you check the source code of CPython, …

  2. what does [::-1] mean in python - slicing? - Stack Overflow

    Slicing Negative numbers for start and stop mean "from the end". It's essianlly equivalent of len-value. Negative number for step means "in reverse order". Empty start means 0 i.e. 1st …

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

    Feb 27, 2023 · Python's slicing also doesn't support 2D/multi-dimensional slicing for lists. The expected output for slicing a multi-dimensional list can be tricky. For example, If you want the …

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

    Feb 14, 2011 · 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 …

  5. python - Slicing arrays in Numpy / Scipy - Stack Overflow

    Slicing arrays in Numpy / Scipy Asked 15 years ago Modified 2 years, 8 months ago Viewed 29k times

  6. How to take column-slices of dataframe in pandas

    May 19, 2012 · 24 And if you came here looking for slicing two ranges of columns and combining them together (like me) you can do something like op = df[list(df.columns[0:899]) + …

  7. Does a slicing operation give me a deep or shallow copy?

    Aug 3, 2016 · The official Python docs say that using the slicing operator and assigning in Python makes a shallow copy of the sliced list. But when I write code for example:

  8. What is row slicing vs What is column slicing? - Stack Overflow

    Feb 2, 2017 · M[:, start:stop] is column slicing CSC is more efficient at retrieving entire columns: the non-zero values of a specific column and the matching row indices are internally stored as …

  9. How to slice a list in Python - Stack Overflow

    Dec 17, 2021 · This creates a new list, it doesn't trim the existing one. To trim in-place, use del on a slice; e.g. del listobj[-x:] will remove the last x elements from the list object.

  10. python - Implementing slicing in __getitem__ - Stack Overflow

    How to define the getitem class to handle both plain indexes and slicing? Slice objects gets automatically created when you use a colon in the subscript notation - and that is what is …