{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Activity 0 Python Quickstart.ipynb", "provenance": [], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "qRPHAjb-E-9Q", "colab_type": "text" }, "source": [ "# Activity 0 - Python Quickstart\n", "**2020 Data Labs REU**\n", "\n", "*Written by Sage Lichtenwalner, Rutgers University, June 8, 2020*\n", "\n", "This notebook is designed as a kickoff activity to our 3-day Intro to Oceanographic Data Processing in Python series. The commands here are simple and provided mostly without context (which will be discussed in later notebooks) in order to highlight some of the advantages of using Python in Research Computing.\n", "\n", "The code from this example was adapted from [A Quick Introduction to Python](https://github.com/ooi-data-lab/data-lab-workshops/blob/master/Summer_Examples/Python_Introduction.ipynb) develoed as part of our 2019 Summer workshop series." ] }, { "cell_type": "markdown", "metadata": { "id": "c5kbjL5UGBia", "colab_type": "text" }, "source": [ "## Notebook and Python Basics" ] }, { "cell_type": "code", "metadata": { "id": "upDBJahnE4LV", "colab_type": "code", "outputId": "83de2152-68a4-4dbb-b88e-f84658f42a17", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "2+2" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "4" ] }, "metadata": { "tags": [] }, "execution_count": 23 } ] }, { "cell_type": "code", "metadata": { "id": "aZ680o6bFuIR", "colab_type": "code", "colab": {} }, "source": [ "a = 42" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "kzdOionBFuNg", "colab_type": "code", "outputId": "b18db6c3-daf0-48de-be0a-e0296dd21e61", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "a" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "42" ] }, "metadata": { "tags": [] }, "execution_count": 25 } ] }, { "cell_type": "code", "metadata": { "id": "fzKT_UMHFuSq", "colab_type": "code", "colab": {} }, "source": [ "b = 'Life, The Universe, and Everything'" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "ZOHMWqmzFuWq", "colab_type": "code", "outputId": "22204f80-6a89-461a-d747-61c8825d5921", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "b" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'Life, The Universe, and Everything'" ] }, "metadata": { "tags": [] }, "execution_count": 27 } ] }, { "cell_type": "markdown", "metadata": { "id": "n4MoZJRaGFMX", "colab_type": "text" }, "source": [ "## A Quick Data Example" ] }, { "cell_type": "code", "metadata": { "id": "x9tzAxI7Fua3", "colab_type": "code", "colab": {} }, "source": [ "import pandas as pd" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "woP9UcXUGLOk", "colab_type": "code", "colab": {} }, "source": [ "url = 'https://marine.rutgers.edu/~sage/OOI_Data_Workshops/CP02PMUO_R9_ar24011.csv'" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "Fk3vEZakGMRD", "colab_type": "code", "outputId": "a437514a-b67b-4157-ca71-ed57c647dfdd", "colab": { "base_uri": "https://localhost:8080/", "height": 419 } }, "source": [ "data = pd.read_csv(url)\n", "data" ], "execution_count": 0, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", " | Depth | \n", "Pressure | \n", "Temperature | \n", "Salinity | \n", "Density | \n", "Fluorescence | \n", "Turbidity | \n", "Oxygen | \n", "
---|---|---|---|---|---|---|---|---|
0 | \n", "14 | \n", "14.109 | \n", "20.0267 | \n", "34.7221 | \n", "1521.47 | \n", "0.0072 | \n", "0.3726 | \n", "34.7187 | \n", "
1 | \n", "15 | \n", "15.116 | \n", "20.0913 | \n", "34.7772 | \n", "1521.73 | \n", "-0.0245 | \n", "0.3700 | \n", "34.7693 | \n", "
2 | \n", "16 | \n", "16.124 | \n", "20.2141 | \n", "34.8684 | \n", "1522.19 | \n", "-0.0361 | \n", "0.3785 | \n", "34.8652 | \n", "
3 | \n", "17 | \n", "17.132 | \n", "20.3139 | \n", "34.9335 | \n", "1522.55 | \n", "-0.0401 | \n", "0.3759 | \n", "34.9386 | \n", "
4 | \n", "18 | \n", "18.140 | \n", "20.4459 | \n", "35.0250 | \n", "1523.03 | \n", "-0.0509 | \n", "0.3744 | \n", "35.0229 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
866 | \n", "6 | \n", "6.046 | \n", "19.9109 | \n", "34.6342 | \n", "1520.92 | \n", "-0.0185 | \n", "0.3842 | \n", "34.6310 | \n", "
867 | \n", "5 | \n", "5.039 | \n", "19.9138 | \n", "34.6359 | \n", "1520.91 | \n", "-0.0323 | \n", "0.3816 | \n", "34.6319 | \n", "
868 | \n", "4 | \n", "4.031 | \n", "19.9145 | \n", "34.6371 | \n", "1520.90 | \n", "-0.0236 | \n", "0.3874 | \n", "34.6333 | \n", "
869 | \n", "3 | \n", "3.023 | \n", "19.9165 | \n", "34.6385 | \n", "1520.89 | \n", "-0.0218 | \n", "0.3842 | \n", "34.6347 | \n", "
870 | \n", "2 | \n", "2.015 | \n", "19.9122 | \n", "34.6354 | \n", "1520.86 | \n", "0.0187 | \n", "0.4047 | \n", "34.6308 | \n", "
871 rows × 8 columns
\n", "\n", " | Depth | \n", "Pressure | \n", "Temperature | \n", "Salinity | \n", "Density | \n", "Fluorescence | \n", "Turbidity | \n", "Oxygen | \n", "
---|---|---|---|---|---|---|---|---|
count | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "871.000000 | \n", "
mean | \n", "225.208955 | \n", "227.110232 | \n", "11.493936 | \n", "35.353968 | \n", "1498.607773 | \n", "-0.259318 | \n", "0.361451 | \n", "35.350359 | \n", "
std | \n", "125.862021 | \n", "126.972414 | \n", "3.870060 | \n", "0.255037 | \n", "11.098248 | \n", "0.159814 | \n", "0.027444 | \n", "0.254881 | \n", "
min | \n", "2.000000 | \n", "2.015000 | \n", "6.252900 | \n", "34.634200 | \n", "1483.100000 | \n", "-0.375900 | \n", "0.328600 | \n", "34.630800 | \n", "
25% | \n", "116.500000 | \n", "117.432000 | \n", "7.907650 | \n", "35.123850 | \n", "1487.855000 | \n", "-0.335200 | \n", "0.346150 | \n", "35.120850 | \n", "
50% | \n", "225.000000 | \n", "226.861000 | \n", "11.021400 | \n", "35.288300 | \n", "1497.670000 | \n", "-0.335000 | \n", "0.352200 | \n", "35.285600 | \n", "
75% | \n", "334.000000 | \n", "336.851000 | \n", "13.775450 | \n", "35.607250 | \n", "1505.530000 | \n", "-0.296100 | \n", "0.367750 | \n", "35.603200 | \n", "
max | \n", "443.000000 | \n", "446.900000 | \n", "20.648000 | \n", "35.793200 | \n", "1523.790000 | \n", "0.327700 | \n", "0.501700 | \n", "35.790500 | \n", "