Take Screenshot using Python PIL

# Importing Image and ImageGrab module from PIL package 
from PIL import Image, ImageGrab 
  
# creating an image object 
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG") 
  
# using the grab method 
im2 = ImageGrab.grab(bbox = None) 
  
im2.show() 

Taking screenshots of specific size or taking screenshots from specific region

# Importing Image and ImageGrab module from PIL package 
from PIL import Image, ImageGrab 
  
# creating an image object 
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG") 
  
# using the grab method 
im2 = ImageGrab.grab(bbox =(0, 0, 300, 300)) 
  
im2.show() 

Parameters: box – The crop rectangle, as a (left, upper, right, lower)-tuple.

References
https://www.geeksforgeeks.org/pyhton-pil-imagegrab-grab-method/
https://stackoverflow.com/questions/19697210/taking-screen-shots-of-specific-size
https://stackoverflow.com/questions/47337811/what-do-the-parameters-of-bbox-mean-in-pillow

numpy.where() in Python

returns the indices of elements in an input array where the given condition is satisfied.

# Python program explaining 
# where() function 

import numpy as np 

np.where([[True, False], [True, True]], 
    [[1, 2], [3, 4]], [[5, 6], [7, 8]]) 
# Python program explaining 
# where() function 

import numpy as np 

# a is an array of integers. 
a = np.array([[1, 2, 3], [4, 5, 6]]) 

print(a) 

print ('Indices of elements <4') 

b = np.where(a<4) 
print(b) 

print("Elements which are <4") 
print(a[b]) 

References
https://www.geeksforgeeks.org/numpy-where-in-python/

Querying data with Pandas .query() method

Single condition filtering

# importing pandas package 
import pandas as pd 

# making data frame from csv file 
data = pd.read_csv("employees.csv") 

# replacing blank spaces with '_' 
data.columns =[column.replace(" ", "_") for column in data.columns] 

# filtering with query method 
data.query('Senior_Management == True', inplace = True) 

# display 
data 

Multiple condition filtering

# importing pandas package 
import pandas as pd 

# making data frame from csv file 
data = pd.read_csv("employees.csv") 

# replacing blank spaces with '_' 
data.columns =[column.replace(" ", "_") for column in data.columns] 

# filtering with query method 
data.query('Senior_Management == True
      and Gender =="Male" and Team =="Marketing"
      and First_Name =="Johnny"', inplace = True) 

# display 
data 

References
https://www.geeksforgeeks.org/python-filtering-data-with-pandas-query-method/