1/343
Looks like no tags are added yet.
$
Reference a specific cell only (does not reference cell relative to it)
IF Statement
=IF(logical_test, [value_if_true], [value_if_false])Nested IF Statement
Used for more complicated criteria (e.g. assigning different grade % a letter mark)
Counts number of cells within range that meet a condition
=COUNTIF(range, criteria)Counts number of cells in range
=COUNTA(value)Adds cells within a range that meet a condition
=SUMIF(range, criteria, sum_range) Calculates average of cells within a range that meet a condition
=AVERAGEIF(range, criteria, sum_range)Returns value in same row for a specific value
=VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)Returns value in same column for a specific value
=HLOOKUP(lookup_value, table_array, row_index_num, range_lookup)Returns value based on value of another cell
=SWITCH(value to switch, value_1, return_1, value_2, return_2, ...)Finds exact or approx value
Range_lookup = TRUE/1 in V/HLOOKUP
Finds only exact value
Range_lookup = FALSE/0 in V/HLOOKUP
Typesetting
Typing symbols and numbers in exact notation in excel
\
Goes before name of symbol to typeset
Generate integer within range
=RANDBETWEEN(lower, upper)Freeze Panes
Keep certain rows/columns visible at all times (have to select row/column no. + 1)
Conditional Formatting
Styles cells in a certain way (i.e. colour, font, font weight) based on certain conditions
Returns nth largest value in set
=LARGE(array, n)Integer
Numeric data type without fractions (e.g. 300, 0, -4)
Float
Numeric data type with fractions (e.g. 34.67, 56.9)
Character
Single letter, digit, punctuation, symbol, or blank space (e.g. a, 1, !)
Boolean
True or false values, true = 1, false = 0
Primitive Data Type
Smallest units of data, atomic
Composite Data Type
Built around primitive data types
String
Sequence of characters, digits, or symbols (text)
Array
List of a number of elements of the same type in a specific order
List
Collection of elements of the same or different type
Less memory usage, better for large numeric datasets
Benefits of array over a list
Pointers
Blocks of memory that are dynamically allocated are managed/stored
Tuple
An ordered collection used to store multiple items in a single variable
Dictionary
A list with assigned key:value pairs
Image Data
Every pixel localised with 2 coordinates. For RGB, pixels have values for red, green and blue channels.
Multispectural Images
3-10+ channels, produces data cube
Variable
A name location in memory
Variable Requirements
Starts with character/underscore, only contains alphanumeric characters or underscore, caps sensitive
Operands
Parts of an equation that operations are performed on (e.g. for 10 × 2 = 20, 10 and 2 are operands)
%, modular
Operator that finds remainder in division
//, floor
Operator that divides and rounds down
**
Exponential
==
Comparison of two sides of equation that returns a Boolean
!=
Inequality operator (opposite of ==)
>=
Greater than or equal to
<=
Less than or equal to
*=
Returns output back to variable
Casting
Turning an element of a certain type into a different type (if possible)
int()
Turns float/string into integer
float()
Turns int/string into float
str()
Turns int/float into string
Parameter
Required input into function that makes function work, in brackets after function
Argument
User input of function that is assigned to a parameter
Keyword Arguments
Argument is directly assigned to parameter (e.g. id=”a1234567”), order does not matter
Positional Arguments
Argument assigned to parameter by order of writing (e.g. “a1234567”)
*args
Packs multiple positional arguments into a tuple
**kwargs
Packs multiple keyword arguments into a dictionary
and
Joins two conditions, conjunction (both must be true for a resulting true value)
or
Disjunction, only one of two conditions must be true for a resulting true value
not
Inverse of condition(s)
Return Value
Function provides a value (i.e. computes it)
Void Function
Function without a return value
Header
Non-indented part of a function/block of code
Body
Indented part of a function/block of code
if/else function
if [condition]:
[action]
else:
[action]if/elif/else function
if [condition]:
[action]
elif [condition]:
[action]
else:
[action]Gives type of item
type([item])Assigns user input to variable
variable = input("[question]")String
Type that user input returns
List
numbers = [1, 2, 3]Array
numbers = np.array([1, 2, 3])Place terms in order
list.sort()Prints term in list
print(list[x])Set value of term
list[x] = ...Gives length of list
len(list)Adds term at end of list
list.append([term])Replaces value of term
list.insert([term], [replacing value])Removes last term
list.pop()Removes specific term
list.pop([term])Clears list
list.clear()Slices list
list[start:end:step]Iteration
for [variable] in [list]:
[action]Iterator object
iter()Gives numbers in range
range(start, stop, step)Performs action for numbers in range
for i in range(start, stop, step):
[action]for loop
Executes a block of code for each element
while loop
Continuation of block of code until a certain criteria is met
Continues action for given condition
while [condition]:
[action]Terminates loop
breakDefines function
def function():
[function]Defines function with parameter
def function([parameter]):
[function]Generators integer between limits
random.randint([lower], [upper])Import all functions from package
from [package] import *Import specific function from package
from [package] import [function]Import function with shorthand
import [package] as [shorthand]Checks for type of argument
isinstance([variable], [type])Shows error message
raise Value ErrorCatches exception
try:
[action]
except:
[action]Rounds to 2 decimal places
number:.2fRounds to 4 decimal places
number:.4fUser Friendly
Try/except error user friendliness
Not User Friendly
Raise error user friendliness
end=’ ‘
kwarg for print function that makes printing all on one line (rather than starting a new line each print instance)