Category: python

  • Crontab – how to

    As a newbie, I’ve been receiving files via email, copying them to my Jupyter Notebook folder, running my script, emailing the resulting outputs back to my customer. As a prospective data scientist I’ve been feeling positively embarrassed about this ridiculously low-tech process! Thanks to my colleagues Shaun and Christine, I’ve been set onto the path…

  • Small simple datasets for practising

    It’s all very well downloading complex datasets from Kaggle and similar sources to play with – they’re amazing for learners because the data is always less clean than you would have hoped, more complex than you anticipated, and every bit as interesting as promised. BUT if you’re learning a new concept it’s easier to have…

  • Adding labels to districts in GeoPandas

    Once you have your districts drawn up nicely, using the polygons from your shapefile, it would be useful to be able to label them – but of course you need to be able to tell GeoPandas where to place these labels via co-ordinates or points – and in your shapefile you only have polygons which…

  • GeoPandas – a detailed example

    Dear World, Please send me more geographical data to plot so I can keep on using GeoPandas… Love from Sho’t Left I can’t believe how much fun this library is! So my goal was to find a way to map assessment ratings by region, showing the overall result for the region, as well as the…

  • Which districts are my cities located in?

    GeoPandas gets more and more exciting as the day wears on :). I’ve just discovered how ridiculously easy it is to take a set of cities and relate them to their corresponding districts, states or provinces and then plot the outcomes. Fanfare for… the marvellous GeoPandas spatial join! Here’s a quick how-to guide to setting…

  • GeoPandas Basics

    Today’s assignment – learn how GeoPandas can help me with data visualizations. Having fallen in love with Pandas this really did seem like the next logical step, and once you understand the principles behind it – which are actually quite nicely documented, then things flow quite logically. This is just the basics of course, but…

  • Data mapping challenge

    For the past month or so I’ve been working away at something that in hindsight looks deceptively simple – but nonetheless taught me loads of new techniques along the way: I wanted to plot data on a map in such a way that it would reflect ratings by province, taking into account the number of…

  • Multivariate regression

    So: with linear regression (aka simple linear regression) we have one feature which we are using to predict a dependent value (for example number of rooms as a predictor of house price). With multivariate regression (aka multiple linear regression) we simply have multiple features which could be used to predict that dependent value (for example…

  • Polynomial regression

    Polynomial regression is a considered a special case of linear regression where higher order powers (x2, x3, etc.) of an independent variable are included. It’s appropriate where your data may best be fitted to some sort of curve rather than a simple straight line. The polynomial module of numpy is easily used to explore fitting the best…

  • Co-variance, Correlation & Linear Regression

    Typically we have 2 sets of values and we want to find out if these 2 sets of values are related, and if so how, and by how much? Could height be indicative of weight? Could hours of practice be related to how many errors are made in a mathematical test paper? Co-variance is a…