AA 2018/2019) Python and Network class @IMT Lucca
The course intend to provide an introduction to programming in python. The application are going to be application to the analysis of complex networks.
Lesson -1) Installation and why
- Conda and virtual environments
- Github
- Jupyter Notebooks
Lesson 0) Basics:
- Data type
- Basic functions
- Logical functions
- List, tuple
- Loops
Lesson 1) Still basics
- Dictionaries
- Function
- Files
- Debugging: raise, try/except, asser
Lesson 2.0.0) Numpy:
- numpy arrays and functions of numpy arrays
- numpy arrays with structured data
- load files/save files
- obtain the adjacency matrix
- calculate the degree sequence
- calculate the clustering coefficient
- save everything somewhere
Lesson 2.0.1) Numpy Random and Random Graphs
- basic random submodule functions for the definition of a Random Graph/Configuration Model as benchmarks
Lesson 2.1) Pandas
- extra
Lesson 3) Matplotlib
- Structure of a matplotlib plot
- plots, scatters, histograms
- legendary legends
Lesson 4) request and BeautifulSoup: how to get the data
- examining the structure of a webpage
- handling the exceptions
- how to get the data we worked on
Lesson 5) NetworkX
"When you need a hand, take a look at the end of your arm.", Ancient Chinese Proverb
Automate the Boring Stuff with Python, by Al Sweigart
MarkDown quick guide
MarkDown long guide
They are changing their policy, but essentially BitBucket gives free private repository, but you have to pay for public ones. Instead, GitHub does the opposite. They both use git for managing the repositories.
They are more than you can think about... Here is a quick tutorial, here you can fine an interesting discussions on StackOverflow, otherwise GitHub itself tries to answer to possible issues. Anyway, when everything is messed up, pray your favorite divinity and try this.
Jupyter
Jupyter guide
Jupyter extensions
Jupyter configurator
NetworkX
python-igraph was not covered by the lectures, but really useful.
Numpy
We did not used it, but Scipy is part of the family of Numpy and Pandas and has submodules of statistics, equation solvers among many others...
Pandas
Matplotlib
Matplotlib plot structure
Matplotlib colors maps
The Remote Notebook guide teaches how to use a jupyter notebook remotely from a server.
tqdm is a cool way to have a progress bar in your loops
Jupyter Widgets are cool, but sometimes it's more annoying fixing them than the beauty they add to your notebook.