# HPC Software Carpentry Course
Welcome to our HPC Software Carpentry course!
## Agenda
Our agenda is here: https://vansteph.github.io/2022-10-25-vu/
Participants:
*
## Feedback
Please tell us during the workshop how you feel so we can change it on the spot!
The speed of the workshop is:
Too slow: +
Just right: +
Too fast: +
Please fill in the post-workshop survey:
> https://carpentries.typeform.com/to/UgVdRQ?slug=2022-10-25-vu
Stop this:
* ..
Continue doing this:
* ...
Start this:
* ...
## Python
Please download the dataset: https://swcarpentry.github.io/python-novice-gapminder/files/python-novice-gapminder-data.zip
All the lesson material is available here:
* Setup: https://swcarpentry.github.io/python-novice-gapminder/setup.html
#### Variables, Types, Built-in functions
* Variables: https://swcarpentry.github.io/python-novice-gapminder/02-variables/index.html
* Types: https://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html
* Built-in functions: https://swcarpentry.github.io/python-novice-gapminder/04-built-in/index.html
#### Libraries, Reading tabular data, Dataframes
* Libraries: https://swcarpentry.github.io/python-novice-gapminder/06-libraries/index.html
* Reading tabular data: https://swcarpentry.github.io/python-novice-gapminder/07-reading-tabular/index.html
* Dataframes: https://swcarpentry.github.io/python-novice-gapminder/08-data-frames/index.html
#### Lists, Loops, Conditionals
* Lists: https://swcarpentry.github.io/python-novice-gapminder/11-lists/index.html
* Loops: https://swcarpentry.github.io/python-novice-gapminder/12-for-loops/index.html
* Conditionals: https://swcarpentry.github.io/python-novice-gapminder/13-conditionals/index.html
* Looping over datasets: https://swcarpentry.github.io/python-novice-gapminder/14-looping-data-sets/index.html
#### Functions, Scope
* Functions: https://swcarpentry.github.io/python-novice-gapminder/16-writing-functions/index.html
* Scope : https://swcarpentry.github.io/python-novice-gapminder/17-scope/index.html
#### Exercises
These are the exercises we did during the course. However, there are more exercises in the course material (linked above), make sure to have a look and get into practice!
* https://swcarpentry.github.io/python-novice-gapminder/11-lists/index.html#fill-in-the-blanks
* https://swcarpentry.github.io/python-novice-gapminder/12-for-loops/index.html#reversing-a-string
* https://swcarpentry.github.io/python-novice-gapminder/13-conditionals/index.html#trimming-values
* https://swcarpentry.github.io/python-novice-gapminder/14-looping-data-sets/index.html#minimum-file-size
* https://swcarpentry.github.io/python-novice-gapminder/16-writing-functions/index.html#encapsulation
### Questions
Please type your questions here, we will answer them during the course or within the hackmd:
Changing the default working directory for Anaconda in windows
* Go to Start and search for "Anaconda Prompt" - right click this and choose "Open File Location", which will open a folder of shortcuts. Right click the "Anaconda Prompt" shortcut, choose "Properties" and you can adjust the starting dir in the "Start in" box. (https://stackoverflow.com/questions/48304305/anaconda-python-change-anaconda-prompt-user-path)
Can you print a string from the end?
* You can use negative indices
Does jupyterlab have a history?
* No history, but you have a undo option in the menu
How can I transfer the type / how to determine the final type?
* ..
What type for the serial number of lab equipment
How can I get an overview of the variables I have?
* There are many ways to do this, for example: dir()`%whos`
check out https://stackoverflow.com/questions/633127/viewing-all-defined-variables
Why are we showing the code using print()? It also shows it when you just run the code.
* This is indeed the case when using notebooks. But often times, just running code does not display it. There you need to use print() if you want to get output on the screen or in a file.
How to get help about a function?
* help()
* e.g. help(function)
Built-in functions
```
dir('__builtins__')
```
How to know what function is right for me?
* Read the documentation of the library (e.g. read the Pandas webpage to get an overview of all functions)
* Google (does it exist in the first place?)
* Stackoverflow, have a look at examples of your community
Can I use the full link if my data is somewhere else?
* Yes! Ideally it is a relative link. So not C/Users/..... Because if you would move the folder your code would break. But essentially any l
The case for Python in Scientific Computing (https://www.datacamp.com/blog/the-case-for-python-in-scientific-computing). Disclaimer: there is also a good R community, but commercial tools like rstudio do not integrate well with clustercomputing.

"if you have a problem to solve, you can most likely find a library to help and it's probably on github!"
ink to your data can be used.
Lambda functions?
* https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.apply.html
Why will append/extend not return a list?
* Lists are mutable and append modifies the list in place, changing the original list stored in our variable without the need to reassign
What is the difference between append and extend?
* extend merges two lists: [1,2] + [3,4] -> [1,2,3,4]
* append adds an element to a list: [1,2] + [3,4] -> [1,2,[3,4]]
* https://www.codingem.com/python-append-vs-extend/
Question regarding indentation / What does indentation do?
* indentation is meaningful in Python, e.g., it is used in a for loop to separate the body from the loop definition; if left out, the scope would change and the body would be executed outside of the loop
Question regarding if loops that contain else if conditions:
* order matters, the loop first checks all lines if the "if" condition is met, then loops over the remaining lines to check the "elif" condition is met
* Conditions are tested once, in order.
Can we combine multiple dataframes within the loop?
* in older versions of pandas, this was done with *append()*
* now, the standard way to do this is using *concat()*
* https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html
What is the difference between = and ==?
* = is assigning a variable
* == means "is equal to"
Return can return several variables, just seperate them with a comma
How can we get the mimum across the entire dataframe?
* DataFrame.min().min()
## Shell
Please download the dataset: https://swcarpentry.github.io/shell-novice/data/shell-lesson-data.zip
All the lesson material is available here:
* Setup: https://swcarpentry.github.io/shell-novice/setup.html
* Lesson: https://swcarpentry.github.io/shell-novice/
### Notes
* How to display history live in auxiliary terminal: https://github.com/4TUResearchData-Carpentries/documentation/blob/master/command-history.md