Using Python with packages such as Numpy, Scipy, Pandas, Matplotlib, etc. (i.e., Scientific Python) is a powerful and easy way to perform scientific calculations and data analysis. Furthermore, coupling scientific Python with Jupyter notebooks makes for a fantastic way to both (1) perform calculation and (2) communicate your results and methods in an effective format. The merging of computations and communication with the Python + Jupyter notebook paring makes the combo and excellent choice for research, homework, and playing around with numbers and functions. The purpose of this repository is to help get students up and running with the basics of using Python and Jupyter notebooks for science calculations.
In the cloud
- Google's Colaboratory (Colab) is a good free resource for collaborative, cloud-based computing. Using Python and Jupyter notebooks in Colab is a perfect place to start.
A big plus associated with running Python and Jupyter notebooks in the cloud is that you don't need to install anything on your local machine. The downsides can be that you need to be connected to the internet, at times it can be slower, and that you have reduced freedom and customization available to you in your workflow.
On your local computer
- Continuum Analytics “Anaconda” distribution: https://www.anaconda.com/download
- To use, you can run/execute python commands with the terminal, an ipython terminal, the Spyder IDE (a Matlab like environment), or my favorite (for short computations and data analysis) - Jupyter notebooks and JupyterLab. The examples in this repository are Jupyter notebooks.
- If you are looking for a text editor, I suggest taking a look at VS Code.
The notebooks in this folder highlight basic commands in Numpy, Scipy, and Matplotlib for simple procedures such as:
- Indexing, arrays, and loops
- Solving functions or implicit equations
- Plotting
- Simple methods for approximating a derivative
The notebooks in this folder explore 15 minute and annual flow data from a USGS gaging station on the New River near Radford, VA (USGS gage 03171000 NEW RIVER AT RADFORD, VA). This set of notebooks focuses on using Pandas and demonstrates simple data analysis operations such as:
- Reading in csv files
- Working with DataFrames
- Filtering
- Plotting
- Regression
You can view the files simply by clicking on the file link in the directory above. To run the notebooks, you will either need to use Colab, or you will need to install a python distribution on your computer (below you will find information on how to install python on your local machine). If you will be using Python regularly, then I suggest you install it on your local machine.
To use Colab, go to https://colab.research.google.com/. If an upload dialogue pops up, then click on the GitHub tab, past in this repository address, https://github.com/kstrm/Starting-out-with-python, and then select the "open notebook in a new tab" icon to the right of the notebook you wish to copy. Doing this will open it in Colab. Once it is open, click on the "Copy to Drive" button to make a copy that you can edit and save in our Google Drive. The notebook will be saved in the folder "Colab Notebooks." The folder will be automatically created in your drive it is not there already.
To you use your local machine you can either download the individual file or clone or download the repository as a whole.
General
- Learn Python with Jupyter
- A Visual Intro to NumPy and Data Representation
- A Gentle Visual Intro to Data Analysis in Python Using Pandas
- Python Weekly - a weekly email newsletter "featuring curated news, articles, new releases, jobs etc related to Python."
Plotting
- Basic… start here: Matplotlib. For more examples see Chapter 4 Robert Johansson's Numerical Python.
- Matplotlib YouTube tutorial series
- Plotting Pandas dataframes: link
- How to Make a Scatter Plot in Python using Seaborn
Tutorials
- Python Tutorial for Absolute Beginners
- Jupyter Notebook Tutorial: The Definitive Guide
- Advanced Jupyter Notebooks: A Tutorial
- Scientific Python Lectures (All lectures). Key lectures:
- Scipy Lecture Notes: One document to learn numerics, science, and data with Python
- Pandas Tutorial: DataFrames in Python