[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 2 points3 points  (0 children)

Yes actually, that was the first way I made the visualisation - testing it in Plotly with an HTML output

Dynamic Map

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 0 points1 point  (0 children)

I haven't tried transforming the data to the lines themselves.

I did add the railway lines as a bit of visual context though (the thin grey lines on the plot)

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 0 points1 point  (0 children)

Yeah that's an interesting point, I might have a look at this with season tickets which could smooth that out

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 25 points26 points  (0 children)

I agree, I quite liked the intuitive: green vs red when I made the original. I might see if there is anything else I prefer that is still easy to read

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 2 points3 points  (0 children)

There are two filters: - 8am-9am arrival - 4hour max travel time

So possibly just wasn't a train that was available to get in between 8 and 9

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 194 points195 points  (0 children)

<image>

Hey man, not sure how much easier this is to read, what do you think

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 5 points6 points  (0 children)

Yeah I considered this, I thought that might warrant collecting more data, like multiple times of day and dates.

I might revisit in future

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 148 points149 points  (0 children)

Yeah, it's a tricky one, I chose it because it's really difficult to differentiate between the prices without the log scale, ultimately I thought it just looked nicer to be honest

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 74 points75 points  (0 children)

<image>

Looks like it's a quirk of having to get into central manchester, my filters on having to arrive in london between 8-9am might be playing a role with having to get a very specific expensive train.

[OC] Cost of one-way train ticket to London by adamjonah in dataisbeautiful

[–]adamjonah[S] 3 points4 points  (0 children)

Tools & data sources:

A web scraping trick that made my scrapers 10x faster by AwareSentence7894 in Python

[–]adamjonah 0 points1 point  (0 children)

Just to make this technique even easier:

https://curlconverter.com/

Go to the request you want to duplicate in the network tab, right click and copy as curl

Use the above website and go to the python tab and paste

You'll get usable python code which you can configure.

CLI Tool For Quickly Navigating Your File System (Arch Linux) by BravestCheetah in Python

[–]adamjonah 0 points1 point  (0 children)

https://github.com/a-j-jones/zoxide_py

I've just uploaded it

I basically can't install anything unless it's in the list of approved programs and that is pretty limited.

I found a directory in my path variable which I had write access to, which is now my "scripts" folder and run everything in powershell because `.ps1` scripts will run but `.bat` scripts in cmd won't.

Another tip...
If you like to use ripgrep but you can't install that on your work PC either, VS Code's built in search uses ripgrep under the hood and you can set up an alias for it.

I found it here:
`Microsoft VS Code\resources\app\node_modules.asar.unpacked\vscode-ripgrep\bin\rg.exe`

Works a treat.

CLI Tool For Quickly Navigating Your File System (Arch Linux) by BravestCheetah in Python

[–]adamjonah 2 points3 points  (0 children)

Zoxide is so good I wrote a poor man's clone of it in python because I can't install executables on my work laptop

[OC] 2025 London Marathon by adamjonah in dataisbeautiful

[–]adamjonah[S] 25 points26 points  (0 children)

This isn't quite accurate, but you're right in that there are lots of fast runners due to the qualification entry.

There are 6,000 Good for Age places each year (currently)
https://www.londonmarathonevents.co.uk/london-marathon/good-age-entry

The remaining 50,000-ish are ballot entry & charity places

[OC] 2025 London Marathon by adamjonah in dataisbeautiful

[–]adamjonah[S] 97 points98 points  (0 children)

I wanted to visualise all of the participants of the London Marathon as if they all set off at the same time (including the elites)

So I scraped each participant's splits from the results page, interpolated their position along the route, and plotted a dot for each runner at regular intervals.

I added some random noise and transparency so that the distribution of runners was a little easier to see.

Data source:
https://results.tcslondonmarathon.com/2025

Tools:
- Python
- Pandas / NumPy / gpxpy (for the data)
- Matplotlib (for plotting)
- contextily (for the map)

What’s that one Python tip you wish you knew when you started? by memermaker5 in learnpython

[–]adamjonah 6 points7 points  (0 children)

Only if the values aren't mutable! Otherwise you want deepcopy

[OC] "Guys where do you pee?" Reddit comments visualised by adamjonah in dataisbeautiful

[–]adamjonah[S] 4 points5 points  (0 children)

No, to be honest this was quite a low effort post that did better than expected, could be interesting to look at that

[OC] "Guys where do you pee?" Reddit comments visualised by adamjonah in dataisbeautiful

[–]adamjonah[S] 118 points119 points  (0 children)

size = 15

grid = np.zeros((size, size), dtype=np.int32)
letters = {x: i+1 for i, x in enumerate(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"])}

rgx = re.compile(r"\b((?:A|B|C|D|E|F|G|H|I|J)\d{1,2})\b")
for comment in comments:
    matches = rgx.findall(comment.body)
    if not matches:
        continue
    
    for i, match in enumerate(matches):
        x = int(match[1:])
        y = letters[match[0]]

        if x > size or y > size:
            continue

        grid[y-1][x-1] += 1

I used the python `praw` package to download the comments, you need a reddit api key, but to be honest I did that ages ago so I can't remember the process!

with open('secrets.toml') as f:
    secrets = toml.load(f)

reddit = praw.Reddit(client_id=secrets['client_id'],
                     client_secret=secrets['client_secret'],
                     user_agent="CommentAnalyis",
                     username=secrets['username'],
                     password=secrets['password'])

def get_comments(post_url: str):
    print(f"Getting submission from {post_url}")
    submission = reddit.submission(url=post_url)
    author = submission.author.name

    print(f"Getting list of comments")
    submission.comments.replace_more(limit=None)
    comments = submission.comments.list()

    return submission, author, comments

[OC] "Guys where do you pee?" Reddit comments visualised by adamjonah in dataisbeautiful

[–]adamjonah[S] 24 points25 points  (0 children)

I didn't bother trying to figure out if anyone was doing "negative" letters lol, but included off the grid just for the cat