Skip to content

Instantly share code, notes, and snippets.

@coryjog
Created May 17, 2018 18:57
Show Gist options
  • Select an option

  • Save coryjog/576e45841b914d6fadcf14cd4c9f5d07 to your computer and use it in GitHub Desktop.

Select an option

Save coryjog/576e45841b914d6fadcf14cd4c9f5d07 to your computer and use it in GitHub Desktop.
Introduction to wind analysis - unit test notebook
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## First test\n",
"This is a test notebook. This blog post assumes you can run the following code in your own notebook. The code was copied and pasted from [this 10-minute introduction to Pandas](https://pandas.pydata.org/pandas-docs/stable/10min.html). "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello wind\n"
]
}
],
"source": [
"print('Hello wind')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 1.0\n",
"1 3.0\n",
"2 5.0\n",
"3 NaN\n",
"4 6.0\n",
"5 8.0\n",
"dtype: float64"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s = pd.Series([1,3,5,np.nan,6,8])\n",
"s"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04',\n",
" '2013-01-05', '2013-01-06'],\n",
" dtype='datetime64[ns]', freq='D')"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dates = pd.date_range('2013-01-01', periods=6)\n",
"dates"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>A</th>\n",
" <th>B</th>\n",
" <th>C</th>\n",
" <th>D</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2013-01-01</th>\n",
" <td>-0.529348</td>\n",
" <td>1.052895</td>\n",
" <td>0.640303</td>\n",
" <td>0.252844</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2013-01-02</th>\n",
" <td>-0.888459</td>\n",
" <td>0.795430</td>\n",
" <td>1.073112</td>\n",
" <td>-0.957200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2013-01-03</th>\n",
" <td>-0.172106</td>\n",
" <td>0.040905</td>\n",
" <td>0.459054</td>\n",
" <td>-1.167859</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2013-01-04</th>\n",
" <td>0.670537</td>\n",
" <td>-2.117747</td>\n",
" <td>1.267443</td>\n",
" <td>-0.292776</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2013-01-05</th>\n",
" <td>-0.798625</td>\n",
" <td>0.364038</td>\n",
" <td>1.731047</td>\n",
" <td>-0.228873</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2013-01-06</th>\n",
" <td>-0.395039</td>\n",
" <td>0.863305</td>\n",
" <td>-0.012052</td>\n",
" <td>-0.545045</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" A B C D\n",
"2013-01-01 -0.529348 1.052895 0.640303 0.252844\n",
"2013-01-02 -0.888459 0.795430 1.073112 -0.957200\n",
"2013-01-03 -0.172106 0.040905 0.459054 -1.167859\n",
"2013-01-04 0.670537 -2.117747 1.267443 -0.292776\n",
"2013-01-05 -0.798625 0.364038 1.731047 -0.228873\n",
"2013-01-06 -0.395039 0.863305 -0.012052 -0.545045"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))\n",
"df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment