Financial Forecasting in Python
Victoria Clark
CGMA Financial Analyst
Date format can be different!
Can cause challenges in:
un-ordered key-value-pairs
For example:
dictionary = {01: 'Jan'}
Directive | Meaning | Example |
---|---|---|
%d | Day of the month as a zero-padded decimal number | 01, 02, …, 31 |
%b | Month as locale’s abbreviated name | Jan, Feb, …, Dec |
%B | Month as locale’s full name | January, …, |
%m | Month as a zero-padded decimal number | 01, 02, …, 12 |
%y | Year without century as a zero-padded decimal number | 00, 01, …, 99 |
%Y | Year with century as a decimal number | 1988, 2001, 2013 |
# Example: 19-02-2018 will be written:
('19-02-2018', '%d-%m-%Y')
iteritems()
function# Create dictionary with strings as keys
# and ints as values
wordFrequency = {
"Hello" : 7,
"hi" : 10,
"there" : 45,
"at" : 23,
"this" : 77
}
# Iterate over dictionary using for loop
for key in wordFrequency:
value = wordFrequency[key]
print(key, " :: ", value)
Hello :: 7
there :: 45
at :: 23
this :: 77
hi :: 10
Financial Forecasting in Python