Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python multiaxis slicing

# Basic syntax:
[your_list[i][start_col : end_col] for i in range(start_row, end_row)]

# Example usage:
your_list = [[1, 2, 3, 4, 5],[6, 7, 8, 9, 10],[11, 12, 13, 14, 15]]
# obtain rows 0-1 (inclusive) and cols 2-3 (inclusive)
[your_list[i][2:4] for i in range(0,2)]
--> [[3, 4], [8, 9]]
Comment

PREVIOUS NEXT
Code Example
Python :: drop list of columns pandas 
Python :: create log in python 
Python :: django queryset last 10 
Python :: change dictionary value python 
Python :: calculate distance in python 
Python :: Python - How To Check if a String Is a Palindrome 
Python :: box plot seaborn python 
Python :: to_csv create folder 
Python :: Find Specific value in Column 
Python :: count down for loop python 
Python :: moving file in python 
Python :: python program to add two numbers using function 
Python :: delete tuple from list 
Python :: python generator comprehension 
Python :: how to make a resizable python tkinter window have a limit 
Python :: what is seaborn in python 
Python :: fill nan values with mean 
Python :: ln in python 
Python :: lambda python 
Python :: pandas dataframe filter 
Python :: split a string with 2 char each in python 
Python :: django check user admin 
Python :: can list comprehenios contain else 
Python :: what is the difference between tuples and lists in python 
Python :: python filter dictionary by keys 
Python :: dataframe string find count 
Python :: django collectstatic 
Python :: python re compile 
Python :: # extract an email ID from the text using regex 
Python :: np.random.RandomState 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =