My flurry into Data Science

I spend most of my day speaking to modellers of some kind, not the ones that walk down the catwalk – the ones that can do amazing things with statistics and a computer!  I work for a media agency with a pretty big Data Science and Econometric modelling function and we’re always hiring. In true… Read More »

Grande Soya Latte & MacBook Pro don’t mix

Here’s a lesson for everyone out there who like to sit in Starbucks with their coffee, working away… leave the lid on!   I don’t normally take my MacBook out in offee shops however I needed to update some code before heading into a meeting so I ordered my Grande Soya Latte, sat down and… Read More »

adding a user profile on sign up with Devise

I have user registration form however to keep it simple I don’t want the user to have to enter lots of details during the initial registration, however want to have them complete a profile page. I wanted the profile to be created on registration so set up a has_one relationship in my model: class User… Read More »

has_many through & fields_for in rails

Took me a while to work this one out but let me paint the scene. I have 3 models as follows: class Student < ApplicationRecord has_many :education_records has_many :qualifications, through: :education_records accepts_nested_attributes_for :qualifications end class EducationRecord < ApplicationRecord belongs_to :student belongs_to :qualification has_many :qualifications has_many :students end class Qualification < ApplicationRecord has_many :education_records has_many :students,… Read More »

Python Snippets

Create new data frame including only certain columns data = pd.read_csv(‘data.csv’) #Select first 22 columns and create dataframe df = data[data.columns[:22]] Add new column with the difference between two dates #datetime.new() gives current date time df[‘new_date_column’] = datetime.now() – pd.to_datetime(df[‘date_to_be_calculatd_from’]) Reordering columns cols = list(df.columns.values) cols reindexed = [‘id’, …., ‘last_column_name’] reindexed_df = df.reindex(columns=reindexed) Create… Read More »

Data Science – Useful Resources

As I count down the days to the start of the Data Science course I’ve been reading a lot of blogs, books and watching a lot of YouTube & Udemy courses. Having not picked up a stats book for the last 15 years, it’s surprising how much I remember! OK, some of the granular detail… Read More »

Starting out in Data Science

There’s a moment of realisation you have at some point in your career whereby you truly believe the rest of the market is missing a trick. I had the chance to work with someone that fuelled my curiosity, while also hopefully me invigorating him and together we just thought differently. It turned out some of… Read More »

Setting up Spec for rails testing

I’m getting to grips with RSpec for testing and getting to grips with some of it’s functionality.  To play around with some of the features I’m building a side project of an employee database, nothing too fancy but just something that stores all the features of an employee, i.e. name, salary, email, location, phone number… Read More »

Bootstrap – Responsive Mobile

I was having trouble with bootstrap adapting to mobile as it was still rendering a full page on my iPhone.  If you have the same issue with your smartphone not showing the responsive layout ensure you have the code below in your header. <meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″ />