# 2023-03 <br> SWD1a: Introduction to Python
Welcome to the hack pad for SWD1a course from Research Computing at the University of Leeds!
You can edit this document using [Markdown syntax](https://guides.github.com/features/mastering-markdown/).
## Contents
1. [Links to resource](#Links-to-resources)
2. [Agenda](#Agenda)
3. [What's your name and where do you come from?](#What’s-your-name-and-where-do-you-come-from)
4. [Further reading](#Further-reading)
5. [Extra code snippets](#Misc-code-snippets)
6. [Challenges](#Challenges)
## Links to resources
- **Contact Research Computing** - https://bit.ly/arc-help
- **Workshop Slides** - https://arctraining.github.io/python-2021-04/
- **Github repository** - https://github.com/ARCTraining/python-2021-04
- **Research Computing website** - https://arc.leeds.ac.uk/
- **Code from the workshop** - https://github.com/ARCTraining/swd1a-03-2023
## Agenda
### Agenda Day 1
| Time | Agenda |
| -------- | ----------------------------------------------- |
| 1000 | Intro, setup What is Python? |
| 1100 | Break |
| 1110 | Python basics, Handling data |
| 1200 | Lunch |
| 1300 | Python packages and Pandas for dataframes |
| 1430 | Break |
| 1440 | Indexing and subsetting, Data types and formats |
| 1550 | Questions |
| 1600 | Close |
### Agenda Day 2
| Time | Agenda |
| -------- | ----------------------------------------------- |
| 1000 | Data Types and formats |
| 1100 | Break |
| 1110 | Combining dataframes |
| 1200 | Lunch |
| 1300 | Loops and functions |
| 1400 | Finishing off merging, loops and functions |
| 1430 | Break |
| 1440 | loops and functions cont., plotting with plotnine|
| 1500 | Bringing it all together |
| 1550 | Questions |
| 1600 | Close |
## What's your name and where do you come from?
- **Add your own entry below using the edit mode**
- Trent McLean-Ash, PhD student
- Martin Wilkinson, CryoEM wizard, School of MCB
- Mojtaba Lashgari, PhD in school of computing.
- Corry Caromawati, PhD in School of Education. I want to learn Phyton because I need a tool to analyze students' language production including accuracy, complexity, emotions, etc.
- James Thorne, Researcher in Food science and Nutrition. I want to learn python as we have just spent a fortune on NGS and want to make the most of it.
- Dev Thacker, post doctoral researcher, faculty of biological sciences
## Further reading
- Python notebook magic commands - https://ipython.readthedocs.io/en/stable/interactive/magics.html
- Pandas documentation - https://pandas.pydata.org/docs/
Here are some links to other resources to continue your Python journey:
- Matt Williams, Bristol RSE Python courses - https://milliams.com/courses/
- RealPython Intro to Python learning path [some paid content] - https://realpython.com/learning-paths/python3-introduction/
- Updated Software Carpentries course - http://swcarpentry.github.io/python-novice-gapminder/
## Misc code snippets
### Conda Environment & Jupyter Notebook
Create an environment and install all packages we are going to use in this training:
- [Pandas](https://pandas.pydata.org/)
- [Jupyter notebook](https://jupyter.org/)
- [Numpy](https://numpy.org/)
- [Matplotlib](https://matplotlib.org/)
- [Plotnine](https://plotnine.readthedocs.io/en/stable/)
To do this, we recommend the all-in-one installer Anaconda ([installation instructions](https://arctraining.github.io/python-2021-04/setup.html) & [cheatsheet](https://docs.conda.io/projects/conda/en/latest/_downloads/843d9e0198f2a193a3484886fa28163c/conda-cheatsheet.pdf)).
After install anaconda, in your terminal window type the following:
```bash
$ conda create -n SWD1a -c conda-forge python numpy pandas matplotlib jupyter jupyterlab plotnine
```
This will install all packages in an evironment named `SWD1a`.
Next, activate the `SWD1a` environment:
```bash
$ conda activate SWD1a
```
Finaly, open a Jupyter notebook:
```bash
$ jupyter lab
```
### Download data:
```python=
# But first we need to download it
!wget -O data.zip https://arctraining.github.io/python-2021-04/data/portal-teachingdb-master.zip
```
### Reading data with pandas
```python
import pandas as pd
file_path = "data/portal-teachingdb-master/surveys.csv"
surveys_df = pd.read_csv(file_path)
```
Here's information about the Introduction to Python workshop, including the agenda, participant introductions, further [Spend Elon Musk Money](https://spendelonmuskmoney.io) reading resources, and code snippets for setting up a Python environment and reading data with Pandas.