In [1]:
%reload_ext autotime
import pandas as pd
from bertopic import BERTopic
from bertopic.representation import KeyBERTInspired
import plotly.io as pio
import plotly.express as px # Plotting
pio.renderers.default = 'notebook'
pd.options.plotting.backend = "plotly"
pd.set_option("display.max_columns", None)
pd.set_option("display.max_colwidth", 100)

df = pd.read_excel("givealittle_health.xlsx")
df.index = pd.to_datetime(df["start"])
df["text"] = df.title.str.cat(df[["pitch", "description", "use_of_funds"]].astype(str), sep=" ")
df
⌛ 1.02 µs (2025-06-12T13:00:28)
Out[1]:
title pitch hero uri amountRaised goal timeLeft action actionUri start end n_questions location n_donors description use_of_funds whos_involved moderated n_updates updates Q&A text
start
2025-06-09 Rugby league lover, Ben Stowers, has had his whole life turned upside down from one tackle. This page has been started to help Ben, his partner and their families with the financial impact... https://static.givealittle.co.nz/assets/hero/82a33c79-46e8-4c6c-ad1a-b2f7010ebbc2-320:False https://givealittle.co.nz/cause/rugby-league-lover-ben-stowers-has-had-his-whole 3070.0 0.0 362 days to go Donate https://givealittle.co.nz/donate/cause/rugby-league-lover-ben-stowers-has-had-his-whole 9 Jun 2025 8 Jun 2026 0 Porirua, Wellington 52.0 On the 22nd of March Ben's life took a turn for the worse, playing the sport he loved - Rugby Le... Travel between Wellington and Christchurch, day to day living expenses, modifications to home Created by\r\nKarra Hanara \n\n\n\n\r\n Paying to a verified bank account of\r\nPeta Manav... Page Moderated NaN NaN NaN Rugby league lover, Ben Stowers, has had his whole life turned upside down from one tackle. This...
2025-06-09 HOPE FOR SUMMER #BATTENSBEATER An ultra rare Princess who is fighting a rare disease Batten Disease CLN1 only one ever in NZ he... https://static.givealittle.co.nz/assets/hero/62b8152b-4f56-4c62-b602-b2f701558791-320:False https://givealittle.co.nz/cause/hope-for-summer-battensbeater 585.0 0.0 727 days to go Donate https://givealittle.co.nz/donate/cause/hope-for-summer-battensbeater 9 Jun 2025 9 Jun 2027 0 Nationwide 14.0 Summer is 11 years old with a rare terminal Disease called Batten Disease CLN1 there is no cure ... Medical costs medical equipment costs making memeories and other expenses for helping Summer to ... Created by, and paying to a verified bank account of,\r\nRay Mudford on behalf of Summer M... Page Moderated 1.0 A little something about Summer 🦄\n11 June 2025\nYou will never see Summer without a reborn she ... NaN HOPE FOR SUMMER #BATTENSBEATER An ultra rare Princess who is fighting a rare disease Batten Dise...
2025-06-08 Help Esther Fight Breast Cancer — A Young Mum from Vanuatu Please help a Vanuatu family through a hard time! https://static.givealittle.co.nz/assets/hero/be4d939b-2ea7-4b03-b2d0-b2f60130466f-320:False https://givealittle.co.nz/cause/help-esther-fight-breast-cancer-a-young-mum 760.0 2100.0 11 days to go Donate https://givealittle.co.nz/donate/cause/help-esther-fight-breast-cancer-a-young-mum 8 Jun 2025 22 Jun 2025 0 Cromwell, Otago 16.0 This fundraiser is for Esther, a strong and loving 31-year-old mother from Vanuatu, who is coura... To Esther treatment in india Created by, and paying to a verified bank account of,\r\nMagali Domingo on behalf of Esther... Page Moderated 1.0 Update on Esther – Thank You for Your Support\n10 June 2025\nGood morning everyone,\nI want to s... NaN Help Esther Fight Breast Cancer — A Young Mum from Vanuatu Please help a Vanuatu family through ...
2025-06-08 $100k in 100 days! Help save a life saving service for mothers in South Auckland & North Waikato https://static.givealittle.co.nz/assets/hero/e70859ac-626e-4150-9be2-b2f9011aee93-320:False https://givealittle.co.nz/cause/savewellwomen 4779.0 100000.0 110 days to go Donate https://givealittle.co.nz/donate/cause/savewellwomen 8 Jun 2025 30 Sep 2025 0 Auckland 63.0 At Well Women Trust, we walk alongside women through some of the most vulnerable times in their ... Well Women Trust needs to raise $100,000 within 100 days to keep services running.We are calling... Created by, and paying to a verified bank account of,\r\n \r\n Well Women\r\n ... Page Moderated NaN NaN NaN $100k in 100 days! Help save a life saving service for mothers in South Auckland & North Waikato...
2025-06-08 Goldenhar Syndrome: Help a Young Girl Through Her Medical Hurdles My daughter was born with Goldenhar syndrome, a rare congenital disorder. After years of treatme... https://static.givealittle.co.nz/assets/hero/f1fc251d-37f0-48f1-aff8-b2f600cd85cd-320:False https://givealittle.co.nz/cause/goldenhar-syndrome-help-a-young-girl 35.0 30000.0 180 days to go Donate https://givealittle.co.nz/donate/cause/goldenhar-syndrome-help-a-young-girl 8 Jun 2025 8 Dec 2025 0 Nationwide 3.0 In 2010, my daughter was born with Goldenhar Syndrome, a rare congenital condition. She has face... Ongoing medical costs. Every sent will be put towards doctors' and hospital bills. Our journey w... Created by, and paying to a verified bank account of,\r\n \r\n Jo Coetzer Page Moderated NaN NaN NaN Goldenhar Syndrome: Help a Young Girl Through Her Medical Hurdles My daughter was born with Gold...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2016-05-02 Amber and Daniel were twins born on 24th and 25th December 2015. They were born at 23 weeks gest... Raising money for the little McSweeney family who have spent the last 5 months in hospital! https://static.givealittle.co.nz/assets/hero/a07c15e8-a593-48bb-a652-a5fa009e35b9-320:False https://givealittle.co.nz/cause/hartleytwinsmicropremmies 4834.0 0.0 closed Read more https://givealittle.co.nz/cause/hartleytwinsmicropremmies 2 May 2016 6 Jun 2016 0 Canterbury 122.0 PLEASE READ THE UPDATE TO THIS POST UNDER UPDATE TAB. We need you all to know how much of an imp... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Elise Hartl... Page Moderated 1.0 Attention all followers of our story\n31 May 2016\nHello, my name is Elise Hartley and I am the ... NaN Amber and Daniel were twins born on 24th and 25th December 2015. They were born at 23 weeks gest...
2016-05-01 Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with brea... Since February '16 Tarnz has undergone two operations; one removing 34 lymph nodes from her righ... https://static.givealittle.co.nz/assets/hero/652566e9-6f90-4632-9b3f-a5f900e9af2c-320:False https://givealittle.co.nz/cause/fightbreastcancerlikeabitch 1550.0 0.0 closed Read more https://givealittle.co.nz/cause/fightbreastcancerlikeabitch 1 May 2016 22 Jul 2016 0 Hawke's Bay 34.0 Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with Grad... NaN Created by_x000D_\n _x000D_\n Nancy Easthope_x000D_\n \n\n\n\n\n_x000D_\n ... Page Moderated NaN NaN NaN Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with brea...
2016-05-01 Cardiology Fundraiser Fundraising for patients & families affected by Heart Disease. https://static.givealittle.co.nz/assets/hero/bfefeb94-f041-478f-80a0-a5f900c0dc47-320:False https://givealittle.co.nz/cause/fund4aheart 915.0 0.0 closed Read more https://givealittle.co.nz/cause/fund4aheart 1 May 2016 15 Aug 2016 0 Waikato 9.0 We aim to provide clients with the most up-to-date education around their Heart Disease diagnosi... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Cardiology ... Page Moderated NaN NaN NaN Cardiology Fundraiser Fundraising for patients & families affected by Heart Disease. We aim to p...
2016-04-30 Help for Julia, while she is caring for Ian Robertson Please support me so I'll be able to continue caring for my dear friend Ian Roberston. He suffer... https://static.givealittle.co.nz/assets/hero/531d73ca-22d8-423b-93be-a5f700a2c8ed-320:False https://givealittle.co.nz/cause/help4julia 2645.0 0.0 closed Read more https://givealittle.co.nz/cause/help4julia 30 Apr 2016 30 May 2016 0 Canterbury 31.0 I'm caring for my dear Kiwi friend Ian Robertson, who suffers from terminal lung cancer. It's ge... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Julia Schlu... Page Moderated NaN NaN NaN Help for Julia, while she is caring for Ian Robertson Please support me so I'll be able to conti...
2016-04-29 TRUS Biopsy Machine for Taranaki The men of Taranaki need this TRUS Biopsy Machine to diagnose Prostate Cancer. Reduce waiting t... https://static.givealittle.co.nz/assets/hero/c9169845-63b5-4c1e-bb50-a5fc00e5abd0-320:False https://givealittle.co.nz/cause/prostatebiopsymachinenewplymouth 1910.0 20000.0 closed Read more https://givealittle.co.nz/cause/prostatebiopsymachinenewplymouth 29 Apr 2016 31 Aug 2016 0 Taranaki 15.0 Currently the TRUS (Trans Rectal Ultrasound) machine for diagnosing prostate cancer is only avai... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Rotary Club... Page Moderated NaN NaN NaN TRUS Biopsy Machine for Taranaki The men of Taranaki need this TRUS Biopsy Machine to diagnose P...

11213 rows × 22 columns

In [2]:
df.amountRaised.resample("1YS").sum().plot.bar()
✔️ 312 ms (2025-06-12T13:00:43/2025-06-12T13:00:43)
In [3]:
df.resample("ME").size().plot()
✔️ 104 ms (2025-06-12T13:00:44/2025-06-12T13:00:44)
In [4]:
keywords = ["covid", "cancer", "leukemia", "heart", "stroke", "kidney", "bowel"]
for word in keywords:
  df[word] = df.text.str.lower().str.contains(rf"\b{word}\b")
df
✔️ 3.19 s (2025-06-12T13:00:44/2025-06-12T13:00:48)
Out[4]:
title pitch hero uri amountRaised goal timeLeft action actionUri start end n_questions location n_donors description use_of_funds whos_involved moderated n_updates updates Q&A text covid cancer leukemia heart stroke kidney bowel
start
2025-06-09 Rugby league lover, Ben Stowers, has had his whole life turned upside down from one tackle. This page has been started to help Ben, his partner and their families with the financial impact... https://static.givealittle.co.nz/assets/hero/82a33c79-46e8-4c6c-ad1a-b2f7010ebbc2-320:False https://givealittle.co.nz/cause/rugby-league-lover-ben-stowers-has-had-his-whole 3070.0 0.0 362 days to go Donate https://givealittle.co.nz/donate/cause/rugby-league-lover-ben-stowers-has-had-his-whole 9 Jun 2025 8 Jun 2026 0 Porirua, Wellington 52.0 On the 22nd of March Ben's life took a turn for the worse, playing the sport he loved - Rugby Le... Travel between Wellington and Christchurch, day to day living expenses, modifications to home Created by\r\nKarra Hanara \n\n\n\n\r\n Paying to a verified bank account of\r\nPeta Manav... Page Moderated NaN NaN NaN Rugby league lover, Ben Stowers, has had his whole life turned upside down from one tackle. This... False False False False False False False
2025-06-09 HOPE FOR SUMMER #BATTENSBEATER An ultra rare Princess who is fighting a rare disease Batten Disease CLN1 only one ever in NZ he... https://static.givealittle.co.nz/assets/hero/62b8152b-4f56-4c62-b602-b2f701558791-320:False https://givealittle.co.nz/cause/hope-for-summer-battensbeater 585.0 0.0 727 days to go Donate https://givealittle.co.nz/donate/cause/hope-for-summer-battensbeater 9 Jun 2025 9 Jun 2027 0 Nationwide 14.0 Summer is 11 years old with a rare terminal Disease called Batten Disease CLN1 there is no cure ... Medical costs medical equipment costs making memeories and other expenses for helping Summer to ... Created by, and paying to a verified bank account of,\r\nRay Mudford on behalf of Summer M... Page Moderated 1.0 A little something about Summer 🦄\n11 June 2025\nYou will never see Summer without a reborn she ... NaN HOPE FOR SUMMER #BATTENSBEATER An ultra rare Princess who is fighting a rare disease Batten Dise... False False False False False False False
2025-06-08 Help Esther Fight Breast Cancer — A Young Mum from Vanuatu Please help a Vanuatu family through a hard time! https://static.givealittle.co.nz/assets/hero/be4d939b-2ea7-4b03-b2d0-b2f60130466f-320:False https://givealittle.co.nz/cause/help-esther-fight-breast-cancer-a-young-mum 760.0 2100.0 11 days to go Donate https://givealittle.co.nz/donate/cause/help-esther-fight-breast-cancer-a-young-mum 8 Jun 2025 22 Jun 2025 0 Cromwell, Otago 16.0 This fundraiser is for Esther, a strong and loving 31-year-old mother from Vanuatu, who is coura... To Esther treatment in india Created by, and paying to a verified bank account of,\r\nMagali Domingo on behalf of Esther... Page Moderated 1.0 Update on Esther – Thank You for Your Support\n10 June 2025\nGood morning everyone,\nI want to s... NaN Help Esther Fight Breast Cancer — A Young Mum from Vanuatu Please help a Vanuatu family through ... False True False False False False False
2025-06-08 $100k in 100 days! Help save a life saving service for mothers in South Auckland & North Waikato https://static.givealittle.co.nz/assets/hero/e70859ac-626e-4150-9be2-b2f9011aee93-320:False https://givealittle.co.nz/cause/savewellwomen 4779.0 100000.0 110 days to go Donate https://givealittle.co.nz/donate/cause/savewellwomen 8 Jun 2025 30 Sep 2025 0 Auckland 63.0 At Well Women Trust, we walk alongside women through some of the most vulnerable times in their ... Well Women Trust needs to raise $100,000 within 100 days to keep services running.We are calling... Created by, and paying to a verified bank account of,\r\n \r\n Well Women\r\n ... Page Moderated NaN NaN NaN $100k in 100 days! Help save a life saving service for mothers in South Auckland & North Waikato... False False False False False False False
2025-06-08 Goldenhar Syndrome: Help a Young Girl Through Her Medical Hurdles My daughter was born with Goldenhar syndrome, a rare congenital disorder. After years of treatme... https://static.givealittle.co.nz/assets/hero/f1fc251d-37f0-48f1-aff8-b2f600cd85cd-320:False https://givealittle.co.nz/cause/goldenhar-syndrome-help-a-young-girl 35.0 30000.0 180 days to go Donate https://givealittle.co.nz/donate/cause/goldenhar-syndrome-help-a-young-girl 8 Jun 2025 8 Dec 2025 0 Nationwide 3.0 In 2010, my daughter was born with Goldenhar Syndrome, a rare congenital condition. She has face... Ongoing medical costs. Every sent will be put towards doctors' and hospital bills. Our journey w... Created by, and paying to a verified bank account of,\r\n \r\n Jo Coetzer Page Moderated NaN NaN NaN Goldenhar Syndrome: Help a Young Girl Through Her Medical Hurdles My daughter was born with Gold... False False False False False True False
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2016-05-02 Amber and Daniel were twins born on 24th and 25th December 2015. They were born at 23 weeks gest... Raising money for the little McSweeney family who have spent the last 5 months in hospital! https://static.givealittle.co.nz/assets/hero/a07c15e8-a593-48bb-a652-a5fa009e35b9-320:False https://givealittle.co.nz/cause/hartleytwinsmicropremmies 4834.0 0.0 closed Read more https://givealittle.co.nz/cause/hartleytwinsmicropremmies 2 May 2016 6 Jun 2016 0 Canterbury 122.0 PLEASE READ THE UPDATE TO THIS POST UNDER UPDATE TAB. We need you all to know how much of an imp... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Elise Hartl... Page Moderated 1.0 Attention all followers of our story\n31 May 2016\nHello, my name is Elise Hartley and I am the ... NaN Amber and Daniel were twins born on 24th and 25th December 2015. They were born at 23 weeks gest... False False False False False False False
2016-05-01 Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with brea... Since February '16 Tarnz has undergone two operations; one removing 34 lymph nodes from her righ... https://static.givealittle.co.nz/assets/hero/652566e9-6f90-4632-9b3f-a5f900e9af2c-320:False https://givealittle.co.nz/cause/fightbreastcancerlikeabitch 1550.0 0.0 closed Read more https://givealittle.co.nz/cause/fightbreastcancerlikeabitch 1 May 2016 22 Jul 2016 0 Hawke's Bay 34.0 Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with Grad... NaN Created by_x000D_\n _x000D_\n Nancy Easthope_x000D_\n \n\n\n\n\n_x000D_\n ... Page Moderated NaN NaN NaN Tania Whanau, known by most as Tarnz, is a strong, 40 year old woman who was diagnosed with brea... False True False False False False False
2016-05-01 Cardiology Fundraiser Fundraising for patients & families affected by Heart Disease. https://static.givealittle.co.nz/assets/hero/bfefeb94-f041-478f-80a0-a5f900c0dc47-320:False https://givealittle.co.nz/cause/fund4aheart 915.0 0.0 closed Read more https://givealittle.co.nz/cause/fund4aheart 1 May 2016 15 Aug 2016 0 Waikato 9.0 We aim to provide clients with the most up-to-date education around their Heart Disease diagnosi... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Cardiology ... Page Moderated NaN NaN NaN Cardiology Fundraiser Fundraising for patients & families affected by Heart Disease. We aim to p... False False False True False False False
2016-04-30 Help for Julia, while she is caring for Ian Robertson Please support me so I'll be able to continue caring for my dear friend Ian Roberston. He suffer... https://static.givealittle.co.nz/assets/hero/531d73ca-22d8-423b-93be-a5f700a2c8ed-320:False https://givealittle.co.nz/cause/help4julia 2645.0 0.0 closed Read more https://givealittle.co.nz/cause/help4julia 30 Apr 2016 30 May 2016 0 Canterbury 31.0 I'm caring for my dear Kiwi friend Ian Robertson, who suffers from terminal lung cancer. It's ge... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Julia Schlu... Page Moderated NaN NaN NaN Help for Julia, while she is caring for Ian Robertson Please support me so I'll be able to conti... False True False True False False False
2016-04-29 TRUS Biopsy Machine for Taranaki The men of Taranaki need this TRUS Biopsy Machine to diagnose Prostate Cancer. Reduce waiting t... https://static.givealittle.co.nz/assets/hero/c9169845-63b5-4c1e-bb50-a5fc00e5abd0-320:False https://givealittle.co.nz/cause/prostatebiopsymachinenewplymouth 1910.0 20000.0 closed Read more https://givealittle.co.nz/cause/prostatebiopsymachinenewplymouth 29 Apr 2016 31 Aug 2016 0 Taranaki 15.0 Currently the TRUS (Trans Rectal Ultrasound) machine for diagnosing prostate cancer is only avai... NaN Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Rotary Club... Page Moderated NaN NaN NaN TRUS Biopsy Machine for Taranaki The men of Taranaki need this TRUS Biopsy Machine to diagnose P... False True False False False False False

11213 rows × 29 columns

In [5]:
df.resample("1M").cancer.sum().describe()
✔️ 28.8 ms (2025-06-12T13:00:48/2025-06-12T13:00:48)
Out[5]:
count    111.000000
mean      37.981982
std        9.530794
min        2.000000
25%       32.500000
50%       38.000000
75%       44.000000
max       58.000000
Name: cancer, dtype: float64
In [6]:
df.resample("1M")[keywords].sum().plot(height=800)
✔️ 84.9 ms (2025-06-12T13:00:48/2025-06-12T13:00:48)
In [7]:
topic_model = BERTopic(representation_model=KeyBERTInspired(), min_topic_size=10, verbose=True)
topic_model.fit(df.text)
topic_model.get_topic_info()
✔️ 47 s (2025-06-12T13:00:48/2025-06-12T13:01:35)
2025-06-12 13:00:48,532 - BERTopic - Embedding - Transforming documents to embeddings.
Batches:   0%|          | 0/351 [00:00<?, ?it/s]
2025-06-12 13:01:06,507 - BERTopic - Embedding - Completed ✓
2025-06-12 13:01:06,508 - BERTopic - Dimensionality - Fitting the dimensionality reduction algorithm
2025-06-12 13:01:28,063 - BERTopic - Dimensionality - Completed ✓
2025-06-12 13:01:28,066 - BERTopic - Cluster - Start clustering the reduced embeddings
2025-06-12 13:01:28,518 - BERTopic - Cluster - Completed ✓
2025-06-12 13:01:28,525 - BERTopic - Representation - Fine-tuning topics using representation models.
2025-06-12 13:01:34,148 - BERTopic - Representation - Completed ✓
Out[7]:
Topic Count Name Representation Representative_Docs
0 -1 4612 -1_diagnosed_cancer_treatment_medical [diagnosed, cancer, treatment, medical, surgery, hospital, support, care, will, family] [Help Christine get the answers and help she needs Christine has tried several options to get th...
1 0 1113 0_cancer_chemotherapy_diagnosed_treatments [cancer, chemotherapy, diagnosed, treatments, treatment, chemo, hospital, support, father, drug] [Robo’s Big Fight – help our whanau pay for ongoing cancer treatment Our Rob has terminal liver...
2 1 1037 1_chemotherapy_cancer_treatments_chemo [chemotherapy, cancer, treatments, chemo, treatment, diagnosed, her, funded, immunotherapy, mum] [Our beautiful Michelle Walker is about to embark on her biggest battle yet and needs our suppor...
3 2 377 2_recovery_rehabilitation_injury_injuries [recovery, rehabilitation, injury, injuries, support, family, stroke, accident, hospital, care] [Jason Leonard’s road to recovery The intention of this page is to help a strong willed man with...
4 3 356 3_charity_wellness_depression_health [charity, wellness, depression, health, suicide, wellbeing, support, mental, supporting, community] [Help me so I can help others. I'm just a kiwi girl, coming forward about mental health. While y...
... ... ... ... ... ...
73 72 11 72_zoe_fiona_lexie_fionas [zoe, fiona, lexie, fionas, zoes, support, wheelchair, expenses, funds, gail] [Fiona's Cheerleaders Rallying support for Fiona and family during an emotionally and financiall...
74 73 11 73_tonsillectomy_surgery_adenoidectomy_tonsils [tonsillectomy, surgery, adenoidectomy, tonsils, gastrostomy, hospital, throat, cyst, nixies, fu... [Please help us raise money for Odins grommets, tonsillectomy and adenoidectomy Please help us r...
75 74 11 74_donating_funds_finances_income [donating, funds, finances, income, financially, family, julia, money, anna, pay] [Offer your support for Toni and baby Mira Michael was taken from us too soon, lets support Toni...
76 75 11 75_ryan_ryans_cancer_diagnosis [ryan, ryans, cancer, diagnosis, chemotherapy, disease, treatment, medical, treatmentslong, care] [Help father to be fight the big C Help us to support Ryan; a soon to be father who has been dia...
77 76 10 76_heart_rheumatic_coughing_doctor [heart, rheumatic, coughing, doctor, hospital, surgery, doctors, breath, valve, icu] [George Riki-Pennicott's Fight for Life 16 year old George was diagnosed with severe heart failu...

78 rows × 5 columns

In [8]:
topic_model.visualize_topics()
✔️ 4.51 s (2025-06-12T13:01:35/2025-06-12T13:01:40)
In [9]:
topics_over_time = topic_model.topics_over_time(df.text, df.index, nr_bins=10)
topics_over_time
✔️ 27 s (2025-06-12T13:01:40/2025-06-12T13:02:07)
10it [00:26,  2.68s/it]
Out[9]:
Topic Words Frequency Timestamp
0 -1 diagnosed, cancer, treatment, medical, surgery 411 2016-04-25 16:07:40.800
1 0 chemotherapy, cancer, diagnosed, tumour, hospital 90 2016-04-25 16:07:40.800
2 1 cancer, chemotherapy, chemo, treatments, diagnosed 70 2016-04-25 16:07:40.800
3 2 recovery, injury, injuries, rehabilitation, support 43 2016-04-25 16:07:40.800
4 3 depression, suicide, charity, grief, health 44 2016-04-25 16:07:40.800
... ... ... ... ...
695 71 surgeries, meg, eclampsia, complications, caesarean 1 2024-07-11 04:48:00.000
696 72 angies, gail, julie, julies, support 3 2024-07-11 04:48:00.000
697 74 finances, donating, funds, meg, financially 3 2024-07-11 04:48:00.000
698 75 keegan, keegans, heart, diagnosis, ryan 1 2024-07-11 04:48:00.000
699 76 coronary, icu, craig, chiropractic, dr 1 2024-07-11 04:48:00.000

700 rows × 4 columns

In [10]:
topic_model.visualize_topics_over_time(topics_over_time, top_n_topics=20, height=600)
✔️ 92 ms (2025-06-12T13:02:07/2025-06-12T13:02:07)
In [11]:
df = df[(df.timeLeft == "closed") & (df.goal > 0)]
df["Target_completion"] = df.amountRaised / df.goal * 100
display(df["Target_completion"].describe())
df.sort_values("Target_completion")
✔️ 58.6 ms (2025-06-12T13:02:07/2025-06-12T13:02:07)
count     4505.000000
mean        64.721481
std        764.409357
min          0.000000
25%          6.051760
50%         23.214286
75%         62.215000
max      44000.000000
Name: Target_completion, dtype: float64
Out[11]:
title pitch hero uri amountRaised goal timeLeft action actionUri start end n_questions location n_donors description use_of_funds whos_involved moderated n_updates updates Q&A text covid cancer leukemia heart stroke kidney bowel Target_completion
start
2024-10-13 Flights needed NZ-London to help 83 year old mum through a mastectomy Raising funds to send a caring daughter to London to look after her 83 year old mum following a ... https://static.givealittle.co.nz/assets/hero/03a34b2c-1401-4460-8ca3-b20800b6f41e-320:False https://givealittle.co.nz/cause/flights-needed-nz-london-to-help-83-year-old-mum 0.0 3340.0 closed Read more https://givealittle.co.nz/cause/flights-needed-nz-london-to-help-83-year-old-mum 13 Oct 2024 16 Oct 2024 0 NaN NaN My mother has breast cancer and at 83 is having a mastectomy on 24th October. She lives alone an... Just the flights Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Sian Jones Page Moderated NaN NaN NaN Flights needed NZ-London to help 83 year old mum through a mastectomy Raising funds to send a ca... False True False False False False False 0.00000
2024-06-01 Me and you against the world Help keep my bro alive ❤️ https://static.givealittle.co.nz/assets/hero/11e8353e-d3b1-4e38-983f-b18200aeb589-320:False https://givealittle.co.nz/cause/me-and-you-against-the-world 0.0 5000.0 closed Read more https://givealittle.co.nz/cause/me-and-you-against-the-world 1 Jun 2024 24 Jun 2024 0 Bay of Plenty NaN Hi my name is Jess, my younger brother Corey (28 years old) was diagnosed with a 9cm pituitary g... Medical expenses - to get an appointment with RestoreMe Clinic and subsequently CBD oil (prescri... Created by_x000D_\nJessica Kelly \n\n\n\n_x000D_\n Paying to a verified bank account of_x0... Page Moderated NaN NaN NaN Me and you against the world Help keep my bro alive ❤️ Hi my name is Jess, my younger brother Co... False False False True False False False 0.00000
2017-03-18 Filling removal to reverse multiple sclerosis Silver filling removal to cure m.s. caused by mercury poisoning https://static.givealittle.co.nz/assets/hero/97b5a6a5-6fb9-432b-9bb0-a73a0110af59-320:False https://givealittle.co.nz/cause/silveramalgalmscauseautoimmunedisorders 4.0 250000.0 closed Read more https://givealittle.co.nz/cause/silveramalgalmscauseautoimmunedisorders 18 Mar 2017 20 Jun 2017 0 Northland 3.0 Old filling removal is dangerous and requires a dentist that really knows how to remove them saf... Silver filling removal, 2 teeth now need to be ripped as as root canal will harbour bacteria and... Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Sandy Howell Page Moderated 1.0 28th april\n3 May 2017\nHad two teeth removed as they required root canals which are a death sen... NaN Filling removal to reverse multiple sclerosis Silver filling removal to cure m.s. caused by merc... False False False True False False False 0.00160
2023-05-19 Charlies life threatening lung complication. This page is set up to help support my family during this time of extreme hardship we are experi... https://static.givealittle.co.nz/assets/hero/bf6e7924-c106-4b1e-b4bf-b0070056a009-320:False https://givealittle.co.nz/cause/charlies-life-threatening-lung-complication 7.0 100000.0 closed Read more https://givealittle.co.nz/cause/charlies-life-threatening-lung-complication 19 May 2023 10 Oct 2023 0 Auckland 3.0 Please help our family as our lives have changed due to our sons right lung not functioning prop... A vehicle, accomadation in a warm home. 2 sons under 3 + new born twins, funds will support us u... Created by, and paying to a verified bank account of,_x000D_\nRobert Shane Williams Page Moderated NaN NaN NaN Charlies life threatening lung complication. This page is set up to help support my family durin... False False False False False False False 0.00700
2019-03-05 Help My Father My Father is diagnosed with Adult CHD. His position is really critical, please help me so that i... https://static.givealittle.co.nz/assets/hero/761d7080-ddd4-42e0-9dea-aa07014cb211-320:False https://givealittle.co.nz/cause/help-my-father 35.0 400000.0 closed Read more https://givealittle.co.nz/cause/help-my-father 5 Mar 2019 30 Apr 2019 0 Auckland 3.0 Hello everyone,\nMy name is Manisha i am a single mother from India currently living in New Zeal... For my father treatment Created by, and paying to a verified bank account of,_x000D_\nmanisha mittal on behalf of M... Page Moderated NaN NaN NaN Help My Father My Father is diagnosed with Adult CHD. His position is really critical, please he... False False False True False False False 0.00875
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2017-01-20 Cancer (Langhan's Cell Histiocytosis) Raising money for treatment and recovery of being paralyzed and going through chemotherapy and h... https://static.givealittle.co.nz/assets/hero/7ca74a99-5881-48a7-a7e4-a6fe0052b1bb-320:False https://givealittle.co.nz/cause/shaunmurphy 1160.0 10.0 closed Read more https://givealittle.co.nz/cause/shaunmurphy 20 Jan 2017 8 Jul 2017 0 Auckland 27.0 Hi, I'm Shaun Murphy and I'm 25 years old.\nIf you don't already know my story, 2 years ago I st... Rehabilitation treatment and any other costs for chemotherapy and physio Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n Shaun murphy Page Moderated NaN NaN NaN Cancer (Langhan's Cell Histiocytosis) Raising money for treatment and recovery of being paralyze... False True False False False False False 11600.00000
2017-03-19 We need to raise funds for Cibele's surgery Please help raise funds to pay for a tumour removal surgery. Any donation will help. Thank you. https://static.givealittle.co.nz/assets/hero/f2446f46-19a2-418b-b6fb-a73b014c6d84-320:False https://givealittle.co.nz/cause/help4cibele 2482.0 20.0 closed Read more https://givealittle.co.nz/cause/help4cibele 19 Mar 2017 1 May 2017 0 Auckland 36.0 Cibele has a tumour in her stomach and desperately needs $20.000 to pay for a surgery to remove ... To pay for a surgery to remove a tumour in her stomach. Created by_x000D_\n _x000D_\n Carmosina Braga Trancoso_x000D_\n \n\n\n\n\n\n\n_... Page Moderated NaN NaN NaN We need to raise funds for Cibele's surgery Please help raise funds to pay for a tumour removal ... False False False False False False False 12410.00000
2017-03-22 To raise money to fight for Justice for Baby Jai curtis Blake preventable Still BIrth Angela and Scott are seeking support with legal fees into the Still Birth of then unborn child t... https://static.givealittle.co.nz/assets/hero/14ca9772-ba50-4f2d-91b6-a73e01280edc-320:False https://givealittle.co.nz/cause/supportbabyjai 277.0 2.0 closed Read more https://givealittle.co.nz/cause/supportbabyjai 22 Mar 2017 30 Apr 2017 0 Canterbury 16.0 Angela lost her baby in utero at 37 weeks full term after a complicated pregnancy and lots of he... funds are to fight the justice system for other women preventing this happening to other expecta... Created by_x000D_\n _x000D_\n April Ritchie_x000D_\n \n\n\n\n\n\n\n_x000D_\n ... Page Moderated NaN NaN NaN To raise money to fight for Justice for Baby Jai curtis Blake preventable Still BIrth Angela and... False False False False False False False 13850.00000
2017-07-18 helping barry after a serious hit n run accident our friend was in a serious hit and run and will be in hospital and after care for some time and... https://static.givealittle.co.nz/assets/hero/2bfd0a24-b2ab-412f-b8f8-a7b400cce458-320:False https://givealittle.co.nz/cause/barrystollery 1450.0 10.0 closed Read more https://givealittle.co.nz/cause/barrystollery 18 Jul 2017 30 Sep 2017 0 Bay of Plenty 18.0 One of our local motorcyclists was severly injured in a hit and run this week in tauranga he is ... help barry to get on his feet and back to some kind of normality ideally he will need to save fo... Created by_x000D_\n _x000D_\n Briar Morreel_x000D_\n \n\n\n\n\n\n\n_x000D_\n ... Page Moderated NaN NaN NaN helping barry after a serious hit n run accident our friend was in a serious hit and run and wil... False False False False False False False 14500.00000
2022-02-24 Help the Mason family William's upcoming surgery/recovery https://static.givealittle.co.nz/assets/hero/10960d59-c892-40b4-8121-ae4a0142f5fa-320:False https://givealittle.co.nz/cause/help-the-mason-family 2200.0 5.0 closed Read more https://givealittle.co.nz/cause/help-the-mason-family 24 Feb 2022 25 Jun 2022 0 Upper Hutt, Wellington 38.0 Hi my name is William and I'm 38 years old and I had a massive Heart attack on the 2nd of Februa... Everything. Travel to appointments in lower hutt and Wellington hospital ,Food, rent, petrol, ki... Created by, and paying to a verified bank account of,_x000D_\n _x000D_\n William Mason Page Moderated 4.0 Thanx all\n12 March 2022\nThanx all your support so far , I can't thank you enough. Have got 2 m... NaN Help the Mason family William's upcoming surgery/recovery Hi my name is William and I'm 38 years... False False False True False False False 44000.00000

4505 rows × 30 columns

In [15]:
df["Target_completion"].resample("1YS").median().plot.bar()
✔️ 96.3 ms (2025-06-12T13:02:23/2025-06-12T13:02:23)
In [16]:
# Take the last part of the location string (most coarse location)
df.location = df.location.str.split(", ").str[-1]
top_10 = df.location.value_counts().head(10)
top_10
✔️ 25.6 ms (2025-06-12T13:02:27/2025-06-12T13:02:27)
Out[16]:
location
Auckland                1339
Canterbury               532
Wellington               450
Waikato                  364
Nationwide               245
Bay of Plenty            188
International            161
Otago                    159
Northland                149
Manawatu / Whanganui     128
Name: count, dtype: int64
In [17]:
df[df.location.isin(top_10.index)].groupby("location")["Target_completion"].mean().sort_values(ascending=False).plot.bar(title="Mean target completion % by location")
✔️ 99.4 ms (2025-06-12T13:02:38/2025-06-12T13:02:38)
In [18]:
df[df.location.isin(top_10.index)].groupby("location")["Target_completion"].median().sort_values(ascending=False).plot.bar(title="Median target completion % by location")
✔️ 53.8 ms (2025-06-12T13:02:43/2025-06-12T13:02:43)
In [19]:
fig = px.box(df[df.location.isin(top_10.index)], x="location", y="Target_completion", title="Target completion % by location")
fig.update_yaxes(range=[0, 200])
fig.show()
✔️ 102 ms (2025-06-12T13:02:49/2025-06-12T13:02:49)
In [20]:
px.scatter(df, x="n_donors", y="Target_completion", trendline="ols")
✔️ 276 ms (2025-06-12T13:02:54/2025-06-12T13:02:55)
In [21]:
px.scatter(df[(df.n_donors <= 200) & (df["Target_completion"] <= 110)], x="n_donors", y="Target_completion", trendline="ols")
✔️ 102 ms (2025-06-12T13:03:07/2025-06-12T13:03:07)
In [22]:
df["duration"] = (pd.to_datetime(df.end) - pd.to_datetime(df.start, format="mixed")).dt.days
px.scatter(df, x="duration", y="Target_completion", trendline="ols")
✔️ 269 ms (2025-06-12T13:03:13/2025-06-12T13:03:13)
In [23]:
px.scatter(df[(df.duration <= 100) & (df["Target_completion"] < 200)], x="duration", y="Target_completion", trendline="ols")
✔️ 111 ms (2025-06-12T13:03:24/2025-06-12T13:03:24)
In [24]:
import statsmodels.formula.api as smf

nona = df.dropna(subset=["location", "n_donors", "duration"])
nona["Cancer"] = nona.text.str.contains("Cancer", case=False).astype(int)
nona["Surgery"] = nona.text.str.contains("Surgery", case=False).astype(int)
nona["Auckland"] = nona.location.str.contains("Auckland").astype(int)
nona["Wellington"] = nona.location.str.contains("Wellington").astype(int)
smf.ols(formula="Target_completion ~ Cancer + Surgery + Auckland + Wellington + n_donors + duration", data=nona).fit().summary()
✔️ 344 ms (2025-06-12T13:03:34/2025-06-12T13:03:34)
Out[24]:
OLS Regression Results
Dep. Variable: Target_completion R-squared: 0.002
Model: OLS Adj. R-squared: 0.001
Method: Least Squares F-statistic: 1.436
Date: Thu, 12 Jun 2025 Prob (F-statistic): 0.197
Time: 13:03:34 Log-Likelihood: -36138.
No. Observations: 4484 AIC: 7.229e+04
Df Residuals: 4477 BIC: 7.233e+04
Df Model: 6
Covariance Type: nonrobust
coef std err t P>|t| [0.025 0.975]
Intercept 65.2029 20.979 3.108 0.002 24.074 106.332
Cancer -8.6531 24.939 -0.347 0.729 -57.546 40.240
Surgery 13.4782 24.481 0.551 0.582 -34.518 61.474
Auckland 2.2188 25.639 0.087 0.931 -48.046 52.484
Wellington 93.8392 38.990 2.407 0.016 17.399 170.279
n_donors 0.0396 0.049 0.814 0.416 -0.056 0.135
duration -0.1153 0.082 -1.407 0.159 -0.276 0.045
Omnibus: 13812.701 Durbin-Watson: 2.003
Prob(Omnibus): 0.000 Jarque-Bera (JB): 1147081371.035
Skew: 46.416 Prob(JB): 0.00
Kurtosis: 2479.081 Cond. No. 941.


Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.