{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" } }, "source": [ "\n", "[*NBBinder test on a collection of notebooks about some thermodynamic properperties of water*](https://github.com/rmsrosa/nbbinder)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" } }, "source": [ "\n", " " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" } }, "source": [ "\n", "[<- Introduction](01.00-Introduction.ipynb) | [Water Contents](00.00-Water_Contents.ipynb) | [References](BA.00-References.ipynb) | [Low-Dimensional Fittings ->](03.00-Low_Dim_Fittings.ipynb)\n", "\n", "---\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Reading the Data\n", "\n", "A table with the variation of density and viscosity in terms of the temperature, at a fixed pressure of $1$ atmosphere, is available in [Batchelor (2000)](BA.00-References.ipynb). The data has been digitized and saved into a local `csv` file. Here we load the table from the file and view and plot the data." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Importing the libraries\n", "\n", "First we import the libraries used in this particular notebook." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Using pandas\n", "\n", "The data has been digitized to the local file `water.csv`. An easy way to retrieve it is with the [pandas.read_csv()](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) function of the `pandas` library:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "water_pd = pd.read_csv('water.csv', header=[0,1])" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Viewing the data with pandas\n", "\n", "The data is diplayed nicely with pandas:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | temp | \n", "density | \n", "viscosity | \n", "
---|---|---|---|
\n", " | Temperature (C) | \n", "Density (g/cm^3) | \n", "Viscosity (cm^2/s) | \n", "
0 | \n", "0 | \n", "0.9999 | \n", "0.01787 | \n", "
1 | \n", "5 | \n", "1.0000 | \n", "1.51400 | \n", "
2 | \n", "10 | \n", "0.9997 | \n", "1.30400 | \n", "
3 | \n", "15 | \n", "0.9991 | \n", "1.13800 | \n", "
4 | \n", "20 | \n", "0.9982 | \n", "1.00400 | \n", "
5 | \n", "25 | \n", "0.9971 | \n", "0.89400 | \n", "
6 | \n", "30 | \n", "0.9957 | \n", "0.80200 | \n", "
7 | \n", "35 | \n", "0.9941 | \n", "0.72500 | \n", "
8 | \n", "40 | \n", "0.9923 | \n", "0.65900 | \n", "
9 | \n", "50 | \n", "0.9881 | \n", "0.55400 | \n", "
10 | \n", "60 | \n", "0.9832 | \n", "0.47500 | \n", "
11 | \n", "70 | \n", "0.9778 | \n", "0.41400 | \n", "
12 | \n", "80 | \n", "0.9718 | \n", "0.36600 | \n", "
13 | \n", "90 | \n", "0.9653 | \n", "0.32700 | \n", "
14 | \n", "100 | \n", "0.9584 | \n", "0.29500 | \n", "