top of page

Companies House Charts (Day 1 of 5)

My exploratory data analysis of Companies House data in August 2020:

Change in 'Mortgages.NumMortOutstanding' for top cities (ranked by the number of companies changing)



Next, the limitations:

  • The regularity of updating Mortgages.NumMortOutstanding isn't consistent across companies

  • Company status wasn't accounted for

  • The town field is not always completed correctly


And the code snippet:

data %>% 
#for each company AND month of return, get change
group_by(CompanyNumber) %>%
arrange(path_ym,.by_group = TRUE) %>%
mutate(
    Mortgages.NumMortOutstanding_prev = lag(Mortgages.NumMortOutstanding,n=1)
) %>%
ungroup() %>%
filter(!is.na(Mortgages.NumMortOutstanding_prev)) %>%
#get diff
mutate(
    Mortgages.NumMortOutstanding_change = Mortgages.NumMortOutstanding - Mortgages.NumMortOutstanding_prev
) %>%
select(path_ym,CompanyNumber,RegAddress.PostTown,Returns.LastMadeUpDate_ymd,Mortgages.NumMortOutstanding_change)

Recent Posts

See All

Improving Excel with Python (May 2022)

Revisited starter script from January 2021: Split Excel file into separate files Excel is essential, and Python is the future - forcing ourselves to practice the latter by automating some of the commo

Message us or

Call us on +44 (0)20 3287 8283

Mon to Fri: 8am-8pm

Weekends: 10am-6pm

bottom of page