A little something for me to follow up on when I’ve got some spare time…
Coding 101 (part 7)
Lists work great but they leave something on the table:
I’ve been building a Tagging Engine in Python as a little exercise to help me learn by doing, using my knowledge so far. It became clear pretty quickly that I needed a better way to handle pairs of data. In this case I was looking at a list of words and the number of times each of them appeared in a text, so that I could rank the most common words by order of significance (frequency). If I just used one list and appended both the word and its count to the list, one value after the other, there was no way I could sort by count number.
I got round this problem by having two lists, one for the words and another for the word counts. I could then manipulate the data as needed. This did work fine in the simple program I wrote, but it was my usual unwieldy, sledgehammer approach again. I knew there was a way I could handle that pair of data points better – using Python’s Dictionaries functionality – but I didn’t want to rush ahead of the curve. Well now I get the chance to learn all about dictionaries. [Read more…] about Coding 101 (part 7)
Coding 101 (fun with lists)
This is me just mucking about with lists, testing out what I’ve learnt so far and applying it to little problems I might want to solve. I find it the best way to learn, and it’s more fun than reading books!
Project 1: Building a tagging engine (Mon 18Apr16)
1. This snippet splits each line into a list, creates an iteration variable to loop through all words in the line list and print them out. I add various print statements at suitable points (both variable print statements and descriptive text statements) to help me test the program structure, to make sure it’s doing what I want and expect it to at each point through the loop. [Read more…] about Coding 101 (fun with lists)
Coding 101 (part 6)
When strings become spaghetti:
Working with strings and files, particular when using the for {line} in {filehandle}: construct, allows us to do some cool manipulation of data, by finding, splitting and stripping the data into different chunks based on some repeating factor (such as a comma spearating each value in order), then sorting, counting and totalling those values through iterative loops. [Read more…] about Coding 101 (part 6)
Marketing Analytics: Applications & Innovations
Customer analytics – a recap:
As we’ve seen in previous posts, there are five important elements to the process of marketing/customer analytics:
1. Start with the data: we need to ensure we have the right data, but we should make sure this is individual-level data – data held for each customer. Without it we can’t do effective customer analytics. So a big question for the company is: how to build the right infrastructure to collect that level of data, with that level of granularity?
2. Exploring the data: we shouldn’t start with big complex models, but look always to start simply with a basic exploration of the data. Even when we go on to use complex mathematical or statistical models, we still need to be able to understand the underlying data, to be able to sense check our explorations and predictions against that data which allows us confidence to assert, yes the underlying data does suggest/show that our modelled effects are real or reasonable. [Read more…] about Marketing Analytics: Applications & Innovations
Holy Crap… Coding Can Be Dangerous
Independent, UK: Man accidentally ‘deletes his entire company’ with one line of bad code. Let this be a warning to us all.
(Hat tip to @JamesGrundner and @Chuck_Moeller‘s DevOps Daily.)
PS: A sensible disaster recovery plan should always include non-connected back-up copies held offsite (certainly where it’s business-critical like it was in this case).
Coding 101 (part 5)
This post follows on from earlier Coding 101 posts and records my responses and learnings from the highly-recommended Python programming book and Coursera specialisation by Charles Severance (see References below).
Opening data files:
In all our previous examples we used data as a constant (i.e. hard-coded into the program some way) or we prompted the user to enter some data which was then manipulated by the program in some way. We want to be able to read data from a variety of sources though – either from files, or from the web – and we know these are going to be much larger data sources, so we’ll need to be able to access and save files on our hard drive somewhere. [Read more…] about Coding 101 (part 5)