Skip to content

Code Fluorite

My online codebook

  • Home

Creating a lottery generator in Microsoft Excel

Posted on July 31, 2022 by Ayelet

I have always wanted to create a lottery generator, either in Excel, Python, or R. I managed to find this tutorial (first published in 2011) on YouTube which creates a lottery generator using Microsoft Excel and basic VBA code. This tutorial is really well explained, and I was able to create a lottery generator in no time at all.

The image below is my version of the tutorial above. This has been updated though beacause the lottery now lets you pick from 59 numbers, than the original 49.

However, I wanted to create a euromillions generator which is based on chosing from five numbers (between 1 to 50), and two numbers (from 1 to 12) called Lucky Stars. This means that a number can appear twice on one ticket, therefore a modification of the excel spreadsheet neeeded to consider this.

The above is possible to do which requires creating a second rand() column based on the Lucky Stars numbers. The tweak to the VBA requires linking the lucky numbers to the columns in the generator tab using the following code to produce the numbers :

Sub euromillions_run()

Worksheets("euromillions-generator").Range("A2:B51").Calculate
Worksheets("euromillions-generator").Range("E2:F13").Calculate
With Worksheets("euromillions-draw-sheet")
    Range("B5").Calculate
    Range("D5").Calculate
    Range("F5").Calculate
    Range("H3").Calculate
    Range("J5").Calculate
    Range("L5").Calculate
    Range("N5").Calculate

End With

End Sub

I’ll use this generator to produce some statistics based on actual lotto results.

Posted in BlogTagged Excel, Numbers, VBALeave a comment

First try at a Tableau Public dashboard

Posted on July 27, 2022 - July 24, 2022 by Ayelet

Data analyst positions require some knowledge of Power BI or Tableau as a way to visualise your data. Typically I used Maps and reports to outline my research, but pivotting into a Data role, it is necessary to learn a visualisation tool so that your data output can be seen by others. Power BI is a microsoft product which is used by many companies, and whilst the software is free to download, publishing your work requires a licence. In contrast, Tableau has a paid and free (public) option so users can get to grips with learning the software and publishing (for free!) a dashboard. So I decided to finally try and create a Tableau Public dashboard using a tutorial published on youtube shown below. Credit to Nestor Adrianzen for publishing this content.

Here is the result of my Tableau Public dashboard.

https://public.tableau.com/app/profile/codefluorite/viz/Apple_tutorial/Apple

This tutorial is great for being taught the basics. I feel I have enough confidence to go off and play with my own datasets and seeing what types of dashboards I can make.

Posted in BlogTagged Tableau, VisualisationLeave a comment

Data Analysis with Python

Posted on July 24, 2022 - July 24, 2022 by Ayelet
DA course free code camp

I love coding, but I have always stuck to R as my master language because I felt so comfortable with it. Although I did learn python during the lockdown of 2020 and upload projects using it to my Github last year, I have tended not to use it that much and I really did need a refresher in it. Whilst more people sign up to coursera or udemy, I have found the courses are freecodecamp to be quite solid in their teaching, Therefore, I have began the Data analysis for Python certificate.

Alongside this, I am refreshing my basic GCSE maths, therefore I thought it was be quite cool to code python alongside this. Today I have uploaded the first of my jupyter notebooks (there are more to come!)

The following link is the one to the github repo containing the first notebook.

https://github.com/codefluorite/codefluorite-freecodecamp-data-analysis-python/tree/main

I’ll be uploading more in the coming weeks, so I hope to finish this certificate by the end of the year!

Posted in BlogTagged Data, jupyter-notebook, pythonLeave a comment

Producing map plots in python

Posted on June 4, 2021 - June 4, 2021 by Ayelet

I have always loved looking at maps. I find them fascinating as they come in map forms (street, geology, land cover etc) that show can show a great deal of spatial information. It was this passion which persuaded me to study Geography and Geology at University and I loved specialising in Geographical Information Systems as it allowed me to create my own maps in a professional environment. Since my undergraduate days I relied too much on the Esri ArcPro environment which is only available under licence and can be quite expensive for making maps as a hobby. Yes, there is QGIS but I really wanted to learn how to map geographical data through python code. The major benefit of coding is that you have complete control over the process. I first experienced coding with python when I attended two NCAS scientific computing courses in 2018. Since then I didn’t have access to the resources to carry on coding (Linux in particular) until this year when I purchased a desktop pc for myself (waahey!).

Refreshing my Linux and python knowledge

So before I actually jumped into coding maps with python I had to refresh my knowledge and actually relearn the Linux environment. I first had to run a linux environment from my windows OS and then install anaconda from the command line. I used the tutorial below to run kali-linux on my system.

Refreshing my NCAS training

The next step was to refresh my NCAS training. This was a great exercise to do and I really enjoyed my time on the course. The jupyter-notebooks are available on my Github:

Link: https://github.com/codefluorite/portfolio_ncas-training

The next task was to refresh basic python knowledge. During lockdown I learnt basic python via the freecodecamp Youtube channel. I create a python repo which will be updated with random python scripts which will support support my on going learning.

Link: https://github.com/codefluorite/python

Now for mapping in python….

I now had a refresh on using python for geographic data it was now time to use my own dataset to support my knowledge. I love eurovision and I really wanted to geographically show how many times a country has won the contest. Whilst the statiscal analysis was evaluated with a PostgreSQL database and R; the map production work was done in a python environment using the geopandas package! I was so happy to produce the following map:

Now there is still room for improvement (the labelling!), but I was so happy to be able to create this data from scratch and it looks like a pretty decent map. During this project I learnt how to merge tables, reproject map projections and create polygons with code! Basic GIS processes that I was so used to in Esri ArcPro. The repo for this project is available at:

Link : https://github.com/codefluorite/eurovision

Posted in Blog, Coding, Github, Linux, Platforms, PythonTagged gis, Linux, Maps, pythonLeave a comment

Eurovision winners – Data science project

Posted on June 1, 2021 - June 1, 2021 by Ayelet

Eurovision 2021 has just been in Rotterdam and Italy have won for the first time in over 30 years. The song that won was sang in Italian and I began to wonder what the language of winning songs and countries were throughout eurovision history. As of 1999 countries can send songs in any language – so I thought it would be a great idea to look at data from 1956 to 1998 and from 1999 to 2021. I therefore created a project which used R, Python and Docker to answer the following questions:

  1. How many participants have taken part since Eurovision began?
  2. What languages were the winning songs from 1956 to 1998?
  3. What languages were the winning songs from 1999 to 2021?
  4. What was the frequency of countries winning from 1956 to 1998?
  5. What was the frequency of countries winning from 1999 to 2021?

The number of participants has been rising since the start of the contest. There was a big jump in the number of participanting countries since the start of the contest holding semi finals in 2004. The maximum number of participating countries is capped at 46 according to the EBU rules and only members can participate with the exception of Australia who is an associate member. With the inclusion of the semi-finals the number of participanting countries remain high as the contest is as popular as ever. This also means winning has become hard as countries not part of the ‘Big 5’ have to first qualify for the final.

The number of participents each year since Eurovision began.

The next figure shows the frequency of times a song in a particular language has won in the contest. I have presented data from 1956 to 1998 as this was when it was required to sing in a native language. There was a brief time in the 1970s where countries could sing in another language but this was reversed. The figure below shows that the songs were in a diverse range of languages with English and French being the most popular.

The next Figure shows the frequency of countries which have won the Eurovision. Most notable results from the data is the frequency of Ireland, United Kingdom, France and Luxembourg which sing in English and French that explain the language data in the above figure.

Winning countries 1999 - 2001

The next figure shows the number of times a particular language has featured in the Eurovision song contest since the language rule change from 1999. With the number of participants remaining high I guess singing in a widely spoken language has become important. However, I’d argue that sending a song in a native language is still important as the most recent winners Italy only send in Italian and the Portugese entry in 2017 remains popular winning song despite portugese only spoken in portugal.

Languages of winning songs 1999 to 2021

The below figure shows the winning countries from 1999 – 2021 and shows a greater range of countries winning the contest. This is possibly down to two reasons. The first being that the rise in participating countries means a greater diversity of song choice and winners. The second being that the reduction in block voting favouring certain countries than others. Whilst this still does happen (hello Greece and Cyprus!) each country has an equal chance of winning if their song in favourable to the public once they have gotten through to the final of couse! It is for this reason which might explain the rise in English being dominant in the contest as countries want to connect and win votes which is easier to do in English than a native tounge which is only understood to your own community. Despite this the recent winning songs in Italian and Portugeese make an arguement as a song being unique in a sea of English songs which can get people voting!

Winning countries 1999 - 2021

What can be taken away from this?

If you want to stand out then sing in your own language!

Posted in Blog, Coding, Github, Linux, pgadmin, Postgres, Python, R, RStudioTagged Data, Eurovision, Graphs, python, rLeave a comment

Calorie counter now online

Posted on May 26, 2021 - May 26, 2021 by Ayelet

Calorie counting applications are popular amongst android and iphone users. The most popular application is myfitnesspal which is a database that calculates the weight and calories of food products whilst giving calories per weight. Whilst useful the information can often be incorrect as it relies on user input. I also want to determine the calories and the weight of the product so I can alter receipes based on this information. I have therefore created a calorie counter web application based on the calories I require and gives the result of this in grams. This tutorial is based on the following BMI calculator: https://www.youtube.com/watch?v=RtbfbldmgSo

The web application: https://counter.codefluorite.com/

The image is available from docker hub:

docker pull codefluorite/calorie-counter:1.0

Source files available on Github: https://github.com/codefluorite/calorie-counter

Posted in Coding, CSS, Docker, Github, HTML, JavaScript, PlatformsTagged css, html, JavaScriptLeave a comment

NCAS data science exercise repo online

Posted on May 23, 2021 - May 26, 2021 by Ayelet

In 2018 I attended the introduction to data science course run by NCAS (National Centre for Atmospheric Science) at their Leeds facility. This course introduced me to python, jupyter notebook, the cf-python and cf-plot packages. I successfully completed the courses and I have now uploaded an example of work onto my github.

During the course I learnt basic commands in the Linux environment and worked with the cf-python and cf-plot packages

An example of these plots include displaying mean air temperature for the winter period between 1960 and 1969.

Mean DJF air temperature

Another example plot which I produced using cf-python and cf-plot includes the stereographic projection of the north wind taken from the ncas training dataset.

Northwind stereographic projection

My jupyter notebooks containing these and other exercises can be accessed from my github repo here.

Posted in Coding, Github, Platforms, PythonTagged cf-plot, cf-python, jupyter-notebook, NCAS, pythonLeave a comment

NumPy basics

Posted on May 19, 2021 - May 19, 2021 by Ayelet
I have now updated my python github repo with a NumPy basics Jupyter notebook document. 

Please visit. 

https://github.com/codefluorite/python/blob/master/NumPy_basics.ipynb
Posted in Coding, PythonTagged pythonLeave a comment

Refreshing my HTML5, CSS3 and basic JavaScript skills

Posted on May 15, 2021 - May 15, 2021 by Ayelet

The project this week was to refresh my and update my HTML and CSS skills. I did this by coding a creative website using the following online tutorial:

I completed the tutorial and personalised it by adding some text fillers and another menu item to fully learn the JavaScript that contributed to the menu. I also became familiar with Microsoft Visual code editor and the nice shortcuts taught in this tutorial. The website has now been uploaded with the following links:

The source code on my GitHub

The live website

Posted in Coding, CSS, HTML, JavaScriptTagged css, html, JavaScriptLeave a comment

Learning Git and Github

Posted on May 13, 2021 - May 10, 2021 by Ayelet

Whilst I have previously used Git and Github it was time to refresh my basic skills in this control system. The git commands that I went through today included:

  • Clone
  • Fork
  • init
  • add
  • commit
  • push
  • pull
  • Creating SSH key
  • Main and naming my own branches

The code to my demo-repo: https://github.com/codefluorite/demo-repo

I learnt to create, modify and commit files to git using Microsofts visual code editor and terminal console. I created a public demo-repo and made various changes and commits to README.md and index.html files. The tutorial was posted on the freecodecamp.org YouTube channel in the following video:

Posted in Blog, GithubTagged Git, Github, tutorialLeave a comment

Posts navigation

Older posts

Github repos

codefluorite (github.com)

Categories

  • Blog
  • Coding
  • CSS
  • Docker
  • Github
  • HTML
  • JavaScript
  • Linux
  • pgadmin
  • Platforms
  • Postgres
  • Python
  • R
  • RStudio

Recent Posts

  • Creating a lottery generator in Microsoft Excel
  • First try at a Tableau Public dashboard
  • Data Analysis with Python
  • Producing map plots in python
  • Eurovision winners – Data science project

Archives

  • July 2022
  • June 2021
  • May 2021

Tags

cf-plot cf-python css Data docker Eurovision Excel game gis Git Github Graphs hello-world html JavaScript jupyter-notebook Linux Maps NCAS Numbers python r Tableau tutorial VBA Visualisation

Categories

  • Blog
  • Coding
  • CSS
  • Docker
  • Github
  • HTML
  • JavaScript
  • Linux
  • pgadmin
  • Platforms
  • Postgres
  • Python
  • R
  • RStudio

Recent Posts

  • Creating a lottery generator in Microsoft Excel
  • First try at a Tableau Public dashboard
  • Data Analysis with Python
  • Producing map plots in python
  • Eurovision winners – Data science project

Archives

  • July 2022
  • June 2021
  • May 2021

Tags

cf-plot cf-python css Data docker Eurovision Excel game gis Git Github Graphs hello-world html JavaScript jupyter-notebook Linux Maps NCAS Numbers python r Tableau tutorial VBA Visualisation
Proudly powered by WordPress | Theme: micro, developed by DevriX.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Cookie settingsACCEPT
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT