# Put any code you'd like to run here!
# For simpler stuff:
import scipy.stats as stats
# For more comprehensive modelling
import statsmodels.formula.api as smf
import pandas as pd
import matplotlib.pyplot as plt
# Bring in my data
= pd.read_csv("../datasets/gapminder.csv")
df
= df[df["country"] == "Australia"]
df = df[["year", "pop"]]
df
# Perform OLS
= smf.ols("pop ~ year", data = df)
model
= model.fit()
results
results.summary()
"year"], results.fittedvalues, "r")
plt.plot(df["year"], df["pop"], ".") plt.plot(df[
2025 Apr 3rd – UQ PUG 17
Welcome to UQ Python User Group! Check out our general info for how we work and what we do. Below you’ll find the details of this month’s gathering.
Overview
Welcome to the second PUG for the year! This month we’re taking a look at Jupyter notebooks.
Structure
- We start today by adding our names to the table below
- Add your questions to this page
- This month’s presentation
- Finally, we spend the rest of the session answering the questions you’ve brought!
Teams
We have moved from a mailing list to a Teams channel! Opt-in to receive PUG updates
How to use this document
This is a Jupyter Notebook, a document format where everything is separated into cells. Each cell contains either markdown, or python.
- The markdown cells allow you to write formatted text
- The python cells allow you to write AND run python
A few tips
- Double click on a cell to edit it
- CTRL + ENTER to run a cell
- Press
+ Code
or+ Markdown
in the top menu to create new cells. Alternatively, press the buttons between cells
Training Resources
We offer Python training sessions and resources, you can find our introductory guide here.
Answers
- You might find this page useful - from our January training intensive
- The
statsmodels
package is your friend here - see how I’ve used it above for an OLS regression. This page has a summary of the functions you can do
Introduce yourself
What’s your name? | Where are you from? | Why are you here? |
---|---|---|
Cameron | UQ Library & SMP | To share and learn |
Anne | China / School of the Environment | Inspired by friend |
He Yang | China / School of the Envirnoment | Inspired by friend |
Jessie | Faculty of Health | Data analysis |
Georgina | Virology PhD | earning about machine learning models in Pythonn |
Duncan | SPPS | Data Analysis to support school academics/Learn to automate tasks in Winndows |
Questions
If you have any Python questions you’d like to explore with the group, please put your question and name in the sections below.
If you think you can help, feel free to contribute to the answers section!
What are your Python use cases? | Cameron
Why do you want to / do use Python
# Put any code you'd like to run here!
Answers
- Answer 1
- Answer 2
- …
Some question | Anne
Add more details here, then press CTRL + ENTER when you’re done
# Put any code you'd like to run here!
Answers
- Answer 1
- Answer 2
- …
How do I run a regression model to check for regression to the mean on a data set in Excel/CSV? | Duncan
Add more details here, then press CTRL + ENTER when you’re done
Markdown in Python outputs | He Yang / Cameron
Add more details here, then press CTRL + ENTER when you’re done
# Put any code you'd like to run here!
# ONce you've installed markdown
from markdown import markdown
Answers
pip install markdown
- Answer 2
- …
Where to start with machine learning? | Jessie
Add more details here, then press CTRL + ENTER when you’re done
# Put any code you'd like to run here!
Answers
- Start with SciKit: https://scikit-learn.org
- Then try Keras: https://keras.io/
- PyTorch: https://pytorch.org/
Check those website for how to install (e.g. with conda
or pip
)
Packaging modules | He Yang
Add more details here, then press CTRL + ENTER when you’re done
# Put any code you'd like to run here!
import final_test_module.test_module as tm
tm.test_function()
Hello!