Browse Source
I've started adding rent information to the file, but is far from done. The plan is to come back to this file as more information about Manchester is processed and ready to be summarised.master
Craig Oates
2 months ago
1 changed files with 94 additions and 0 deletions
@ -0,0 +1,94 @@
|
||||
#+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline author:t |
||||
#+options: broken-links:nil c:nil creator:nil d:(not "LOGBOOK") date:t e:t |
||||
#+options: email:nil expand-links:t f:t inline:t num:t p:nil pri:nil prop:nil |
||||
#+options: stat:t tags:t tasks:t tex:t timestamp:t title:t toc:t todo:t |:t |
||||
#+title: Summary Manchester |
||||
#+date: \today |
||||
#+author: Craig Oates |
||||
#+email: craig@craigoates.net |
||||
#+language: en |
||||
#+select_tags: export |
||||
#+exclude_tags: noexport |
||||
#+creator: Emacs 29.1.90 (Org mode 9.7-pre) |
||||
#+cite_export: |
||||
|
||||
* Setup Common Lisp Environment |
||||
|
||||
You will not need to execute this code block if you've already set up SLIME in |
||||
another ORG file. This is just in case this is the only file you're working on |
||||
today, or it's your first file of the day. |
||||
|
||||
*Run ~m-x slime~ before running the following code.* And, make note of the |
||||
~:session~ attribute. It allows you to use the code in the code block to be use |
||||
in other code blocks which also use the ~:session~ attribute. |
||||
|
||||
#+begin_src lisp :session :results silent |
||||
(ql:quickload :com.inuoe.jzon) ; JSON parser. |
||||
(ql:quickload :dexador) ; HTTP requests. |
||||
(ql:quickload :plump) ; HTML/XML parser. |
||||
(ql:quickload :lquery) ; HTML/DOM manipulation. |
||||
(ql:quickload :lparallel) ; Parallel programming. |
||||
(ql:quickload :cl-ppcre) ; RegEx. library. |
||||
(ql:quickload :plot/vega) ; Vega plotting library. |
||||
(ql:quickload :lisp-stat) ; Stat's library. |
||||
(ql:quickload :data-frame) ; Data frame library eqv. to Python's Numpy. |
||||
(ql:quickload :str) ; String library, expands on 'string' library. |
||||
#+end_src |
||||
|
||||
* Rent Summary |
||||
|
||||
I should point out here, the prices have deliberately removed overly expensive |
||||
listings. They are unrealistic to my personal living conditions in 2024. So, the |
||||
data relayed below is not a complete reflection of the companies/sources listed |
||||
within it. |
||||
|
||||
This table will be added to over time, as I work my way through more |
||||
website/companies. I've decided to copy them over from the files holding said |
||||
information. It's just easier to do so because of how small the data is. Coding |
||||
this up would take to long, for little gain. |
||||
|
||||
#+NAME: manc-avg-rent |
||||
| Company | Quantity | Avg-Rent | Search-Range | Min-Rent | Max-Rent | |
||||
|----------------+----------+----------+--------------+----------+----------| |
||||
| Right Move | 121 | 1204 | £275–£1500 | 945 | 1495 | |
||||
| Spare Room | 647 | 589 | £100–£1260 | 300 | 1260 | |
||||
| Ideal Flatmate | 17 | 714 | £200–£1200 | 480 | 956 | |
||||
| | | | | | | |
||||
|
||||
#+begin_src lisp :var table=manc-avg-rent :results output raw |
||||
(let ((filepath #P"working-data/manc-avg-rent-feb-2024.csv")) |
||||
(with-open-file (stream |
||||
filepath |
||||
:direction :output |
||||
:if-exists :supersede) |
||||
;; This needs to be added manually because of the use '|--+--|' in the table |
||||
;; above. If the table's header changes, you will need to updated here, as |
||||
;; well. It's a bit of pain but it is what it is. |
||||
(format stream "Company,Quantity,Avg-Rent,Search-Range,Min-Rent,Max-Rent~%") |
||||
(dolist (row table) |
||||
(format stream "~{~a~^,~}~%" row))) |
||||
(format t "[[file:~a]]" filepath)) |
||||
#+end_src |
||||
|
||||
#+RESULTS: |
||||
[[file:working-data/manc-avg-rent-feb-2024.csv]] |
||||
|
||||
#+begin_src lisp :results file |
||||
(let* ((values (lisp-stat:plist-df `(:x-axis #("Right Move" "Spare Room" "Ideal Flatmate") |
||||
:y-axis #(1204 589 714))))) |
||||
(vega:defplot manc-avg-rent |
||||
`(:title "Average Rent Rates Manchester Feb. 2024" |
||||
:mark :bar |
||||
:width 600 |
||||
:height 600 |
||||
:data ,values |
||||
:encoding (:x (:field :x-axis :title "Company" :type :nominal :axis ("labelAngle" 0)) |
||||
:y (:field :y-axis :title "Rent Average (£)" :type :quantitative) |
||||
:tooltip (:field :y-axis)))) |
||||
(vega:write-html manc-avg-rent "renders/manc-rent-averages-feb-2024.html")) |
||||
#+end_src |
||||
|
||||
#+RESULTS: |
||||
[[file:renders/manc-rent-averages-feb-2024.html]] |
||||
|
||||
[[file:./renders/manc-rent-averages-feb-2024.png]] |
Loading…
Reference in new issue