Python Automation and Machine Learning for EM and ICs

An Online Book, First Edition by Dr. Yougui Liao (2019)

Practical Electron Microscopy and Database - An Online Book

Table of Contents/Index

Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

   
"Extract, Transform, Load" (ETL) and " Extract, Load, Transform" (ELT) processes  
Tungsten in Spark  
Building an effective machine learning team  
Trade-offs between fairness and performance  
Decision threshold in ML  
Text summarization for ML  
FastText for ML  
Timeseries prediction in ML  
Analytics and Technology Automation (ATA)  
Transformer in ML  
Pre-training in ML  
GPT (Generative Pre-trained Transformer)  
Google Translate  
TensorFlow Playground  
Python Tutor  
Trade-off between minimizing loss and minimizing complexity  
Evaluation (Precision and Recall) in Text classification with Naive Bayes  
Precision and Recall Tradeoff  
Text classification with Naive Bayes  
Search patterns in a text file  
Theorem Proving  
Goal State and Goal Test in ML  
Transition model  
Stationary and Non-Stationary State Transitions in Markov Decision Process (MDP)  
Trade-off between exploration and exploitation, and epsilon(ε-) greedy exploration  
State transition function (probability) in reinforcement learning  
Open datasets, and open-source tools and libraries for ML practice  
Time of training a ML algorithm  
Hyperbolic tangent (Tanh) function  
Comparison among sigmoid, hyperbolic tangent (tanh) and rectified linear unit (ReLU) functions  
Holidays/Festivals/Vocations (Thanksgiving/Christmas)  
Regular decision trees and decision trees with bagging  
Data parallelism in distributed training  
Misclassification loss in decision trees  
Hyperparameter tuning (model tuning)  
Linear correlation between two variables with Pearson Correlation Coefficient, Spearman Rank Correlation Coefficient, Kendall's Tau, Linear Regression, Coefficient of Determination, and Correlation Ratio  
True Function  
True Distribution  
No Free Lunch Theorems  
Margin Theory  
Learning theory  
Tricks for learning three dimensional geometry  
Splitting a training dataset into different subsets  
Choice of parameters for training models  
Training score/training error  
Training error versus model complexity  
Kernel tricks and kernel function  
L2 regularization/Ridge/ridge regularization/Tikhonov regularization  
Representer theorem and its derivation  
Training set  
Transpose of vector and matrix and their equations  
Trace of a square matrix  
Binary trees  
Kendall Tau Rank Correlation Coefficient  
Threading  
Generalization Error/Generalization Loss/Test Error/Expected Error of Hypothesis/Risk  
True Mean in ML  
Deviation Threshold in ML  
True risk in ML  
Two-sample t-test  
t-SNE (t-distributed stochastic neighbor embedding, from sklearn.manifold import TSNE)  
try and except  
Save the text in clipboard to a txt file  
Color in table obtained by matplotlib.pyplot/change background color of cells in table/colored with threshold  
Try a number of times before exception or fail  
Diversity prediction theorem  
Mirror/reflect image from left to right/from top to bottom  
Three dimensional shapes/structures  
Modify/replace the line in a text file if a line contains specific string  
except TypeError  
Hide/turn on/off axes/axis on matplotlib  
Common values in two pandas series  
Crop/snip (without opening the image) part of a image with definition by a pixel line (with transparent added portion)  
Convert a number type to another  
.norm() (Taxicab Norm, Manhattan Norm, Euclidian Norm and Vector Max Norm)  
Script execution limited by retry time  
Predictive/predict model (with "best"-option table)  
Microsoft Teams  
Clean clipboard and/or check if clipboard is empty, text or image  
Tracking process in ML  
Tensors and vectors  
Output (target variable, y, Y)  
Training process in ML (with "best"-option table)  
Trained model and automatic model selection  
Metrics to monitor during training and testing  
Train-dev-test split (training-validation-testing split: Ratio for splitting dataset into training, validation and test sets  
Typical training setup in AI and comparisons of different training libraries  
Text/keyword classification/sort/prediction, training/test e.g. Youtube spam  
Empirical loss/training loss  
Train/Test versus Model Accuracy  
Training Exmaple (x, y)  
TensorFlow  
3 ways to create a Keras model with TensorFlow
Sequential API to create a Keras model with TensorFlow  
Functional API to create a Keras model with TensorFlow  
TensorFlow Data Validation (TFDV)  
Model Subclassing to create a Keras model with TensorFlow  
Supervised learning with tensorFlow  
Comparison between scikit-learn and tensorflow  
Comparison between TensorFlow, PyTorch, Theano and OpenCV  
Comparison between steps and epochs in TensorFlow  
Commands
train_and_evaluate  
RunConfig  
save_checkpoints_steps  
model_fn  
train_op  
end( )  
get_shape()  
export_savedmodel  
tf.saved_model.save()  
serving_input_fn  
checkpoint_path  
input_fn  
tf.keras.optimizers.Adam  
tf.Variable  
tf.distribute.Strategy  
tf.Graph()  
.as_default()  
tf.constant()  
tf.Session  
tf.function  
tf.data
tf.data API  
tf.data.Dataset  
tf.data.TextLineDataset()  
tf.data.TFRecordDataset()  
tf.data.Dataset.from_tensor_slices  
tf.data.FixedLengthRecordDataset  
tf.feature_column.categorical_column_with_identity  
tf.feature_column.bucketized_column  
Basics of tensors
Rank/ranking tensors  
Shape of tensor  
Flow of tensor  
Size in tensor  
Axis/dimension of tensor  
Neural networks with TensorFlow  
TensorBoard  
Variables in TensorFlow  
Hook  
after_run function  
stop_if_no_decrease_hook  
early_stopping.stop_if_no_decrease_hook  
Comparison between Keras and Estimators (tf.estimators)  
Keras  
Categorical features preprocessing layers  
tf.keras.layers.CategoryEncoding (categoryEncoding layer)  
tf.keras.layers.Hashing (hashing layer)  
tf.keras.layers.StringLookup (stringLookup layer)  
tf.keras.layers.IntegerLookup (IntegerLookup layer)  
Trainable layers  
tf.keras.layers.Discretization  
tf.keras.layers.normalization  
tf.keras.layers.StringLookup (stringLookup layer)  
Non-trainable layers  
tf.keras.layers.Hashing (hashing layer)  
tf.keras.layers.TextVectorization  
tf.keras API  
tf.keras.datasets (e.g. MNIST, CIFAR-10, CIFAR-100, Fashion MNIST)  
tf.estimator  
tf.estimator.evaluate()  
tf.estimator.EstimatorSpec  
tf.estimator.ModeKeys.TRAIN  
tf.estimator.Estimator  
tf.estimator.Estimator.get_variable_value  
tf.estimator.experimental.stop_if_no_decrease_hook  
tf.estimator.Estimator.get_variable_names()  
tf.estimator.Estimator.get_variable_value(name)  
tf.estimator.Estimator.evaluate  
tf.estimator.Estimator.predict  
Training in TensorFlow  
tensorflow_ranking (TensorFlow Ranking)  
Typical training setup in AI and comparisons of different training libraries  
TensorFlow APIs  
History/hot topics of machine learning  
Transform process in ML  
Feature extraction using radon transform  
Save the webpages obtained by Google search into a text file  
Troubleshooting/debugging and problem solving in Python programming  
Thresholding with Match Template: Match on images to find and to highlight unsimilar (threshold=0) to identical (threshold=1) regions of an image that match a template with a cross-correlation method  
Detection and Visualization of Peak Intensities in Images with Adjustable Dot Marking and Thresholding   
Open a new tab in an application window  
Open task manager window  
Table of powerPoint shortcut hotkeys  
Table of PC/computer/Windows shortcut hotkeys  
Table of Word shortcut hotkeys  
Table of Excel shortcut hotkeys  
Table of Chrome shortcut hotkeys  
Loops (e.g. for loop) for 2D (two-dimensional) plot (or map)  
Table of digital micrograph (DM) shortcut hotkeys  
Go to the pointed tab on an app  
Type capital letters  
Check to see if or get a window with a name containing specific titles or texts  
stopwatch and timing/countering a process  
Turn on and off with mouse press or a process/button switch, button state  
Copy text to clipboard  
Tricks in Python Programming and principles and practices in good programming  
Term Frequency-Inverse Document Frequency (TF-IDF)  
Print colored text in Python IDLE's terminal  
Find the best word/text similarity  
Copy text into clipboard and then use it immediately (one time clipboard)  
API (Application Programming Interface), e.g. weather, temperature  
Detection of tables from an image  
type()  
Send emails in HTML and text formats  
matplotlib.pyplot axis/text color  
Image matching with cross correlation and overlap of template edge. In this matching process, Normalized cross-correlation with those edge images is performed.  
Cross correlation between two images  
Cross correlation between two images in any sizes. Multiscaling is used to avoid the issue caused by the different sizes of the template and original image, in order to find match in a original image, namely, the size of template is larger than the original image.  
Copy text into clipboard and then you can paste it anywhere  
Merge/combine two text files (and add a new line to the beginning of a text file)  
Highlight texts or make selection  
Data structures (Data science, and comparison between list, tuple, set, dictionary)  
Set default programs by file extensions and by file types and programs on Windows  
Numpy: Access the element at the second row, the third entry, access a specific row or a column, access some elements (submatrix), or replace/modify an element in the array, print a transfer of an array, access array under conditions or filtering  
.T (Transfer of array in Python)  
Copy text into clipboard and then you can paste it a webpage, text/txt, word or powerpoint file automatically  
Count the times of repeated excutions  
Open any files, e.g. text (.txt), image files, and so on. .txt file will be opened in Python program, e.g. IDLE shell.  
Swap two numbers  
Extract three blue, green, red images from a color image or grey image, or convert RGB (color) image into three blue, green, red images  
Count the number of lines (rows) and columns in a txt (and a csv) file, count different numbers in each region in a column, count missing or not available values  
Sum two images after resizing them  
Create images with global, adaptive mean, adaptive Gaussian, binary, trunc, Tozero, and tozero thresholds.  
Bail out/terminate of a loop  
Create slides with text only  
Text Format in pptx  
Find and convert the file time/date  
Read its nthcharacter in a text file  
Transparency of marker (e.g. for plots)  
matplotlib.pyplot axis/text color (xticks, rotation, xlabel, ylabel, title, fontsize, grid(), legend(), show())  
Find files with a specific file extension/type or with file names ending with specific characters  
Simple watchdog to monitor file/folder changes (monitor file creation and then write the file paths into the text file)  
Convert a CSV file to a TXT file  
Execute scheduled jobs (time-schedule)  
Find common elements/items between two lists  
top and left for pptx  
Time and date used as a file/folder name stamp (e.g. duplicate a file in the same folder)  
matplotlib.pyplot axis/text color (title, xticks, rotation, xlabel, ylabel, title, fontsize, grid(), legend(), show())  
Sort a text file  
Search text on an image  
Search/extract/find text on an image  
Extract text/check specific text from multiple powerpoint files  
Take a screenshot using a mouse click and drag method. For instance, take a screenshot, and then insert the image and/or a text into a ppt file.  
Top (ranking) Python libraries/modules  
Resize and then sum/mix/overlap two images  
Shift/translate image along x-axis/y-axis  
Resize and then sum/mix/overlap two images (w/o transparency)  
Break/exit/skip a function/code line after a certain time  
Decision tree learning  
Textrank  
Count occurrence/nubmer of words/phrase in a text file  
Convert a text file to a string  
Ranking/most popular programming languages/tools for data analysts  
Convert PDF file to text file  
Write/save content to a text file  
Generate text file with the bank of collecting all words, characters and strings from news  
Remove \n in string or new line in txt/text file  
Critical thinking in data science  
Remove duplicate/same lines in a text file  
Ranking/most popular automation testing tools  
Ranking/most popular IT automation software tools  
Extract a mask from an image with a threshold  
Mask an image with a threshold or with a color as a threshold  
Add/insert text to an image  
Fault analysis/PFA (Physical Failure Analysis) time and efficiency  
Plot table  
Read/print a text/txt file  
Extract a table from a webpage or text file  
Convert DataFrame to a HTML Table and save as a HTML webpage  
Write contents of DataFrame/memory into text file  
Various names or terms that describe similar concepts or techniques in ML  
Taylor expansion  
"True label" ("observed label") in machine learning  
BERTScore/BERT (Bidirectional Encoder Representations from Transformer)  
Natural Language Processing (NLP) versus Text  
Tokenization  
Two-dimensional neural network  
Classification of groups of texts  
Common Words for Classification of Groups of Texts  
Bayes' theorem (Bayes rule or Bayes law) in machine learning  
Test process in machine learning  
NLTK (Natural Language Toolkit)  
Regression tree/decision tree for regression  
Classification tree/decision tree for classification  
Various names or terms that describe similar concepts or techniques in ML  
Good research topics in the field of semiconductor manufacturing and computer vision  
AI/machine learning algorism for text analysis  
Trick: return True and return False  
Clustering versus Classification of texts and documents  
Clustering of texts  
Classification of texts  
Multimodal text and image similarity  
Get the latest/newest/most recent file in a folder within certain time/days  
Multimodal text and image search  
Create table on pptx with certain rows and columns of strings  
Create table on pptx with certain rows and columns in DataFrame  
Text search  
Sentence, text and document embeddings  
(Text and image) contrastive learning  
Overfitting and underfitting  
Bias and variance, and bias-variance trade-off in ML  
Compare/check if two text files have the same contents  
Count number of lines in a text file  
Check existence of phrase on text file line-by-line  
Modify HTML webpage (e.g. with graph network by adding/inserting text/hyperlink in)  
Insert paragraphs of texts into Python script  
igraph for clustering, network and tree  
String template class for formating strings (F-strings (for calculation) (f"{}"), format() method ({}), %s, %d, Template ($))  
Check if all the (and how many, length of a string) characters in the text are digits/numbers  
Summary/templates of plotting graphs/figures  
Continue script execution no matter whether some try fails or not (finally)  
Remove duplicate cell values from a csv file/dataframe (keeping the first/top one)  
Trick: pd.concat() for merging/adding (two) columns  
Get the last line in a text file  
Read line-by-line from a text file  
Plot multiple images on the same figure by hiding x- and y-(tick) labels on axis  
Find the same elements in columns in two separate dataframes and then merge them  
Trick: generic code/script templates for complex automation  
Compare (pattern/ratio of) two different columns, check whether column values match in DataFrame  
Check whether one column contains number only and another column contains letters only or mixture of numbers and letters in DataFrame  
Check the difference between two columns in DataFrame  
Avoid duplicates when creating text file  
matplotlib.pyplot to plot/generate images (with axis/colored text or annotation)  
Check if two lists have the same elements  
Compute the similarity between two text documents/files (with heatmap)  
BERTScore (Bidirectional Encoder Representations from Transformer) for text  
Nearest/most similar lyrics of a sentence/text to a CSV file  
SentenceTransformers  
Transfer data from Python module to a YAML file  
Automatically restart script execution, for xyz times, after it breaks/fails/error  
Avoid two or multiple plots being wrongly/incorrectly/unnecessarily mixed/overlap  
Summary/templates/examples of pptx and PowerPoint format  
Create a temporary file or directory/folder  
RegEx (Regular Expression) (characters to check if a string contains a specified search pattern, remove double spaces, and clean texts)  
Recall (Sensitivity or True Positive Rate) in machine learning  
CSV column transposer (rows/columns)  
Filters the rows based on the condition of being within n days of today's date  
Plot a figure with a colored arrow between text lines/steps  
Truth (True) and False Table  
Check if all/any values are true or false in a range of data  
Tableau integration with Python  
tableauhyperapi module  
Convert a sentence/text to a list  
Replace the lines between two lines “xx” and “yy” in a text file with new lines  
Color the Tables in pptx (PowerPoint)  
Color and rotate/vertical text in pptx  
Selecting only numeric/number columns, and then select two specific columns for plot  
Hide x-axis tick labels (only show some labels) where x values are under certain conditions  
Create table with merged cells on pptx  
Font size of tick labels in plot  
Font size of a (single/multiple) cell in table in PowerPoint  
Only use the first 4 characters in the headers of the table for pptx/dataframe  
Populate the table with logarithmic format in pptx  
Perform transpose operations (x-axis to y-axis, and vice versa) on a given dataframe  
Cheatsheet of .txt file manipulation  
.apply(tuple, axis=1)  
Cheatsheet of tuples  
HTTP(Hypertext Transfer Protocol)/URL (Uniform Resource Locator)  
.Label()  
.iconbitmap()  
.destroy()  
.config()  
justify='center', justify='right', justify='left'  
global  
PhotoImage()  
Frame()  
pady=  
borderwidth=  
Toplevel()  
fill=tk.X  
padx=  
ipadx=  
FLAT, RAISED, SUNKEN, GROOVE and RIDGE in Tkinter button relief styles  
Widget in Tkinter  
.title()  
.text()  
Merge two csv files  
Theano  
top and left for locateOnScreen()  
Stateful preprocessing layers (adapt() method)  
TextVectorization  
StringLookup  
IntegerLookup  
Normalization  
Discretization  
File name, folder name. {}{}....format. Manipulation of file and folder names (rename file name and folder name): i) Create a new folder and then copy all files from a folder to the new folder and rename the file, and then open the file. If the folder exists, then no file will be copied, but the file will still be opened. ii) Print and export the folder names and file names (with or without extensions) from a folder into a text file. iii) csv2image filename. Introduction
Compute the difference between two images by using Structural Similarity Index with "pip install --upgrade imutils" code. code
Subtract (minus) two images after resizing them code, code.
Find the greatest of three numbers code1, code2, code3.
DataFrame workflow: Drop/delete rows with empty cells in a column, Sort DataFrame by time/date order
true_values CSV: list of strings to recognize as True
thousands CSV: specifies the thousands separator. If not None, this character will be stripped from numeric dtypes. However, if it is the first character in a field, that column will be imported as a string. In the PythonParser, if not None, then parser will try to look for it in the output and parse relevant data to numeric dtypes. Because it has to essentially scan through the data again, this causes a significant performance hit so only use if necessary.
pandas.DataFrame.to_csv() CSV: DataFrame.to_csv(path_or_buf=None, sep=',', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', encoding=None, compression='infer', quoting=None, quotechar='"', line_terminator=None, chunksize=None, date_format=None, doublequote=True, escapechar=None, decimal='.', errors='strict', storage_options=None). Write the contents of the Frame into a CSV file: code.
.T (Transfer of array in Python) Introduction
tupleize_cols CSV: boolean, default False, if False, convert a list of tuples to a multi-index of columns, otherwise, leave the column index as a list of tuples
tupleize_cols CSV: If False (default), write as a list of tuples, otherwise write in an expanded line format suitable for read_csv
Series.to_csv() CSV: Is a 1-D ndarray with axis labels and writes the given series object to a comma-separated values (csv) file/format. code.
train_test_split (code)
transform() (code)
Open tast manager (code)
.tripleClick() .tripleClick(x=moveToX, y=moveToY) (Code)
.typewrite() E.g. .typewrite('Hello world!\n', interval=secs_between_keys); .typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys). (Code)
Tuples Introduction, and data structures. Are very similar to lists. A tuple contains elements which can be treated individually or as a group. The difference from lists is that tuples are immutable, meaning that after they’re defined, you code can’t change anything about them. E.g. can neither set value nor sort tuples. A tuple may also contain heterogeneous elements (e.g. a string and an integer): Example code. Declaration: tup = tuple(); tup = (); tup = (2, 5, 10); tup = (2004, "Python", 3) and tup = (8,). Tuples are useful in operations like swapping etc.: swap two numbers, Example code2.
threading.Thread() Convenience class for creating stoppable threads. The Thread() accepts many parameters. The main ones are: target: specifies a function (fn) to run in the new thread. args: specifies the arguments of the function (fn). The args argument is a tuple. Introduction.
Thread(target=fn,args=args_tuple)
ternary The ternary operator performs the same task as the if-else construct.
Syntax:
<Output variable> = <The result when the condition is true>
if <condition> else <The result when the condition is not true>
code
textwrap.fill code.
tkinter
tkinter popup windows Introduction
import tkinter as tk code
import tkinter.messagebox Import messagebox from tkinter module. code.
from tkinter.filedialog import askopenfilename code. code.
entry.delete(0, tk.END) Use the special constant tk.END for the second argument of .delete() to remove all text in an Entry
relwidth The relative width of the background. (code)
try This block lets you test a block of code for errors. Introduction. code.
shapes.title (code)
.text_frame() (code)
__truediv__  
__trunc__  
timeout Blocking timeout for reading events.
timeout

Event queue block timeout.

threading.Thread() Convenience class for creating stoppable threads. The Thread() accepts many parameters. The main ones are: target: specifies a function (fn) to run in the new thread. args: specifies the arguments of the function (fn). The args argument is a tuple. Introduction.
Thread(target=fn,args=args_tuple)
Text (txt) files in Python (Two types of files can be handled in python, normal text (.txt) files and binary files)
.read() .read([number of characters = optional]). Read the entire .txt file in Python. read([n]): Returns the read bytes in form of a string. Reads n bytes, if no n specified, reads the entire file. Introduction. .txt to read the entire file. .txt to read a specific number of characters. code. code
.readline() Read the first line and the first lines in a .txt file in Python. Introduction. txt.
.readlines() Read all the lines in a .txt file in Python. txt.
Sort txt files Introduction
import fileinput (code)
rstrip() (code)
os.path.splitext() Introduction.
replace() (code) (code)
Remove lines Remove all the lines before the starting text. Introduction.
Replace contents/letter Replace contents and change letter cases in text files. Introduction
Insert/add text or line Insert text or new text lines to a specific position, at the end of a line, in a file. Introduction
Codes Details
Count the number of lines (rows) and columns in a txt (and a csv) file, count different numbers in each region in a column, count missing or not available values CSV: Introduction. code.
'r'
Introduction. Read Only: Open text file for reading. The handle is positioned at the beginning of the file. code
'r+' Introduction. Read and Write: Open the file for reading and writing. The handle is positioned at the beginning of the file. code
'w' Introduction. Write Only: Open the file for writing. For existing file, the data is truncated and over-written.
'w+' Introduction. Write and Read: Open the file for reading and writing. For existing file, data is truncated and over-written.
'a' Introduction. Append Only () : Open the file for writing. The file is created if it does not exist. The handle is positioned at the end of the file. The data being written will be inserted at the end, after the existing data.
'a+' Introduction. Open the file in append & read mode, e.g. append and Read: Open the file for reading and writing. The file is created if it does not exist. The handle is positioned at the end of the file. The data being written will be inserted at the end, after the existing data. (code)
math.tan(x) Returns the tangent of x radians.
math.tau() Returns the mathematical constant tau (6.283185 . . .).
title code. code. code.
to_bytes  
text code. code. code.
mss.tools.to_png (code)
datetime.time An idealized time, independent of any particular day, assuming that every day has exactly 24*60*60 seconds. (code)
datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. (code)
datetime.tzinfo An abstract base class for time zone information objects. (code)
datetime.timezone A class that implements the tzinfo abstract base class as a fixed offset from the UTC. (code)
.date.today() Get current date: code (in different formats) and code. (code)
time.time() Introduction. code
title() Make the first letter in each word upper case. code. code.
scipy.linalg.toeplitz Create a Toeplitz matrix.
tensordot(a, b[, axes]) Compute tensor dot product along specified axes.
trace(a[, offset, axis1, axis2, dtype, out]) Return the sum along diagonals of the array.
linalg.tensorsolve(a, b[, axes]) Solve the tensor equation a x = b for x.
linalg.tensorinv(a[, ind]) Compute the ‘inverse’ of an N-dimensional array.
__closure__/tuple name/type: the function closure, i.e. bindings for free variables (often is None)
__defaults__/tuple name/type: default values for the formal parameters
Text I/O f = open("myfile.txt", "r", encoding="utf-8"), f = io.StringIO("some initial text data").
Python Twisted Is an event-driven networking engine, Twisted is written in Python, and licensed under the open-source MIT license.
cv2.TM_SQDIFF() method=CV_TM_SQDIFF
cv2.TM_SQDIFF_NORMED method=CV_TM_SQDIFF_NORMED
cv2.TM_CCORR method=CV_TM_CCORR
cv2.TM_CCORR_NORMED method=CV_TM_CCORR_NORMED
cv2.TM_CCOEFF_NORMED() method=CV_TM_CCOEFF_NORMED
The third parameter here is the method used for matching. code, code. code.
cv2.TM_CCOEFF method=CV_TM_CCOEFF
cv2.THRESH_BINARY If pixel intensity is greater than the set threshold, value set to 255, else set to 0 (black). code. code
cv2.THRESH_BINARY_INV Inverted or Opposite case of cv2.THRESH_BINARY. code. code
to_clipboard([excel, sep]) Attempt to write text representation of object to the system clipboard. This can be pasted into Excel, for example.
to_dict(*args, **kwargs) Convert DataFrame to dictionary.
to_html([buf, columns, col_space, colSpace, ...]) Render a DataFrame as an HTML (www, webpage) table.
to_sql(name, con[, flavor, schema, ...]) Write records stored in a DataFrame to a SQL database.
to_timestamp([freq, how, axis, copy]) Cast to DatetimeIndex of timestamps, at beginning of period
to_records([index, convert_datetime64]) Convert DataFrame to record array.
to_string([buf, columns, col_space, ...]) Render a DataFrame to a console-friendly tabular output.
to_dense() Return dense representation of NDFrame (as opposed to sparse)
to_excel(excel_writer[, sheet_name, na_rep, ...]) Write DataFrame to a excel sheet
to_gbq(destination_table[, project_id, ...]) Write a DataFrame to a Google BigQuery table.
to_hdf(path_or_buf, key, **kwargs) activate the HDFStore
to_json([path_or_buf, orient, date_format, ...]) Convert the object to a JSON string.
to_latex([buf, columns, col_space, ...]) Render a DataFrame to a tabular environment table.
to_msgpack([path_or_buf]) msgpack (serialize) object to input file path
to_panel() Transform long (stacked) format (DataFrame) into wide (3D, Panel) format.
to_period([freq, axis, copy]) Convert DataFrame from DatetimeIndex to PeriodIndex with desired
to_pickle(path) Pickle (serialize) object to input file path
to_sparse([fill_value, kind]) Convert to SparseDataFrame
to_stata(fname[, convert_dates, ...]) A class for writing Stata binary dta files from array-like objects
title Plot title as string
numpy.transpose() Reverse or permute the axes of an array; returns the modified array. For an array a with two axes, transpose(a) gives the matrix transpose of swapping. code.
turtle Library
t.shape() “classic”, “arrow”, “turtle”, “circle”, “square” and “triangle”. (code)
t.speed() Is used to change the speed of the turtle by the value of the argument that it takes. E.g. .speed(speed=None). The turtle’s speed lies in the range 0-10. If input is a number greater than 10 or smaller than 0.5, speed is set to 0. ‘fastest’ : 0; ‘fast’ : 10; ‘normal’ : 6; ‘slow’ : 3; ‘slowest’ : 1. (code)
t.Screen() Is used to set the size and position of the main window. (code)
t.getscreen() Return the TurtleScreen object the turtle is drawing on. (code)
t.getcanvas() Return the Canvas of this TurtleScreen. (code)
winfo_height() Contain the dimensions of the current turtle graphics window. (code)
t.screensize() turtle.screensize(canvwidth=None, canvheight=None, bg=None). If there is no parameter, then it is getting the actual screen size. (code)
.right() (code)
random.choice() Randomly select from options. (code)
randint(start, end) randint() is an inbuilt function of the random module in Python3. (code)
t.penup()/t.pu()/t.up() Pull the pen up – no drawing when moving. (code)
t.pendown()/t.pd()/t.down() Pull the pen down – drawing when moving. (code)
t.circle()

turtle.circle(radius, extent=None, steps=None). radius – a number; extent – a number (or None); steps – an integer (or None). (code)

.color() (code)
Collections of geometric shape (code)
.goto()

.goto(x, y=None) x – a number or a pair/vector of numbers; y – a number or None. (code)

.getcanvas().postscript(file="") Picture saved in current working directory. (code)
.forward() (code)
.fillcolor() “fillcolor”: color-string or color-tuple. (code)
.backward() (code)
t.begin_fill() To be called just before drawing a shape to be filled. (code)
t.end_fill() turtle.end_fill(). Fill the shape drawn after the last call to begin_fill(). (code)
.left() (code)
t.hideturtle()/t.ht() Make the turtle invisible while you’re in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably. (code)
hotkey('t') Introduction
hotkey('tab') Introduction
.getAllTitles() Get all the Python program windows, *IDLE Shell window, e.g. *IDLE Shell 3.9.5, the most front window on Dreamweaver, the most front webpage on each Chrome window, the name of each opened applications, e.g. DigitalMicrograph. Introduction
.getWindowsWithTitle() Introduction
.topleft (code)
.activate() Activate a window: with the active cursor in the window and the window is brought to the most front on the monitor. (code)
.GetWindowText() (code)
highlightthickness= (code)
textvariable= (code)
.tags= (code)
.top/.bottom/.left/.right Introduction
feature_extraction.text (code)
TfidfVectorizer() (code)
.get_feature_names_out() (code)
.toarray() (code)
TfidfTransformer (code).
.query() (code).
  (code).
skipgram model (for training) (code)
CBW model (for training) (code)
text_color= (code).
.terminate() (code).
driver.navigate().to(“http://globalsino.com”)
Navigate to URL
.DataFrame() Introduction. .drop(), index, columns, axes, dtypes, size, shape, ndim, empty, T (swap between column and row), values
.set_xticks() (code)
.set_xticklabels() (code)