Converted python comments to markdown to improve readability.

This commit is contained in:
Donne Martin 2015-01-25 09:22:23 -05:00
parent adc34fe231
commit da26235b6d

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:edcc4cf748f3ab5825f4dab84a30b30044d5590de3f7466f257b76edb77cb900"
"signature": "sha256:a48b1c3b6ae983dc7986e59c8abba5c3d99be60fcd624714c2aff0b2ca0a2562"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -80,11 +80,17 @@
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extract the equivalent date object"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Extract the equivalent date object\n",
"dt.date()"
],
"language": "python",
@ -101,11 +107,17 @@
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extract the equivalent time object"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Extract the equivalent time object\n",
"dt.time()"
],
"language": "python",
@ -122,13 +134,17 @@
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When aggregating or grouping time series data, it is sometimes useful to replace fields of a series of datetimes such as zeroing out the minute and second fields."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# When aggregating or grouping time series data, it is sometimes\n",
"# useful to replace fields of a series of datetimes such as zeroing\n",
"# out the minute and second fields.\n",
"dt.replace(minute=0, second=0)"
],
"language": "python",
@ -152,11 +168,17 @@
"## strftime"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Format datetime string"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Format datetime string\n",
"dt.strftime('%m/%d/%Y %H:%M')"
],
"language": "python",
@ -180,11 +202,17 @@
"## strptime"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Convert a string into a datetime object"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Convert a string into a datetime object\n",
"datetime.strptime('20150120', '%Y%m%d')"
],
"language": "python",
@ -208,11 +236,17 @@
"## timedelta"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get the current datetime"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Get the current datetime\n",
"dt_now = datetime.now()"
],
"language": "python",
@ -220,11 +254,17 @@
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Subtracting two datetimes results in a timedelta"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Subtracting two datetimes results in a timedelta\n",
"delta = dt_now - dt\n",
"delta"
],
@ -242,11 +282,17 @@
],
"prompt_number": 11
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Adding a datetime and a timedelta results in a datetime"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Adding a datetime and a timedelta results in a datetime\n",
"dt + delta"
],
"language": "python",