Skip to content

Instantly share code, notes, and snippets.

@jiaweih
Created December 24, 2013 20:17
Show Gist options
  • Save jiaweih/8117444 to your computer and use it in GitHub Desktop.
Save jiaweih/8117444 to your computer and use it in GitHub Desktop.
Extracted from 10 Minutes to Pandas
{
"metadata": {
"name": "10 Minutes to Pandas"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": "import pandas as pd",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": "import numpy as np",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": "s = pd.Series([1,3,5,np.nan,6,8])",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": "s",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"text": "0 1\n1 3\n2 5\n3 NaN\n4 6\n5 8"
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": "dates = pd.date_range('20130101',periods=6)",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": "dates",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": "<class 'pandas.tseries.index.DatetimeIndex'>\n[2013-01-01 00:00:00, ..., 2013-01-06 00:00:00]\nLength: 6, Freq: D, Timezone: None"
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": "df = pd.DataFrame(np.random.randn(6,4),index=dates,columns=list('ABCD'))",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": "df",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819\n2013-01-06 1.043172 1.034652 0.251056 1.321124"
}
],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": "df2 = pd.DataFrame({ 'A' : 1.,\n 'B' : pd.Timestamp('20130102'),\n 'C' : pd.Series(1,index=range(4)),\n 'D' : np.array([3] * 4),\n 'E' : 'foo' })",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": "df2",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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 <th>E</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td> 1</td>\n <td> 2013-01-02 00:00:00</td>\n <td> 1</td>\n <td> 3</td>\n <td> foo</td>\n </tr>\n <tr>\n <th>1</th>\n <td> 1</td>\n <td> 2013-01-02 00:00:00</td>\n <td> 1</td>\n <td> 3</td>\n <td> foo</td>\n </tr>\n <tr>\n <th>2</th>\n <td> 1</td>\n <td> 2013-01-02 00:00:00</td>\n <td> 1</td>\n <td> 3</td>\n <td> foo</td>\n </tr>\n <tr>\n <th>3</th>\n <td> 1</td>\n <td> 2013-01-02 00:00:00</td>\n <td> 1</td>\n <td> 3</td>\n <td> foo</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"text": " A B C D E\n0 1 2013-01-02 00:00:00 1 3 foo\n1 1 2013-01-02 00:00:00 1 3 foo\n2 1 2013-01-02 00:00:00 1 3 foo\n3 1 2013-01-02 00:00:00 1 3 foo"
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": "df2.dtypes",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"text": "A float64\nB object\nC int64\nD int64\nE object"
}
],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.head()",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819"
}
],
"prompt_number": 12
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.tail(3)",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"text": " A B C D\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819\n2013-01-06 1.043172 1.034652 0.251056 1.321124"
}
],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.index",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"text": "<class 'pandas.tseries.index.DatetimeIndex'>\n[2013-01-01 00:00:00, ..., 2013-01-06 00:00:00]\nLength: 6, Freq: D, Timezone: None"
}
],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.columns",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"text": "Index([A, B, C, D], dtype=object)"
}
],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.values",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 16,
"text": "array([[ 1.34761856, 1.13406108, 0.21149371, 0.41205707],\n [ 0.70776785, -0.20531103, -0.84185248, -0.15941418],\n [ 1.01286098, -0.07645989, -0.03356748, 1.98461703],\n [ 0.37980396, -0.41592547, 1.25925616, 0.72428649],\n [-0.25169672, -0.26669547, 0.63457967, -0.17481879],\n [ 1.04317201, 1.03465233, 0.25105622, 1.32112431]])"
}
],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.describe() #NOT df.describe",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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>count</th>\n <td> 6.000000</td>\n <td> 6.000000</td>\n <td> 6.000000</td>\n <td> 6.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td> 0.706588</td>\n <td> 0.200720</td>\n <td> 0.246828</td>\n <td> 0.684642</td>\n </tr>\n <tr>\n <th>std</th>\n <td> 0.573256</td>\n <td> 0.693828</td>\n <td> 0.698638</td>\n <td> 0.851120</td>\n </tr>\n <tr>\n <th>min</th>\n <td>-0.251697</td>\n <td>-0.415925</td>\n <td>-0.841852</td>\n <td>-0.174819</td>\n </tr>\n <tr>\n <th>25%</th>\n <td> 0.461795</td>\n <td>-0.251349</td>\n <td> 0.027698</td>\n <td>-0.016546</td>\n </tr>\n <tr>\n <th>50%</th>\n <td> 0.860314</td>\n <td>-0.140885</td>\n <td> 0.231275</td>\n <td> 0.568172</td>\n </tr>\n <tr>\n <th>75%</th>\n <td> 1.035594</td>\n <td> 0.756874</td>\n <td> 0.538699</td>\n <td> 1.171915</td>\n </tr>\n <tr>\n <th>max</th>\n <td> 1.347619</td>\n <td> 1.134061</td>\n <td> 1.259256</td>\n <td> 1.984617</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 17,
"text": " A B C D\ncount 6.000000 6.000000 6.000000 6.000000\nmean 0.706588 0.200720 0.246828 0.684642\nstd 0.573256 0.693828 0.698638 0.851120\nmin -0.251697 -0.415925 -0.841852 -0.174819\n25% 0.461795 -0.251349 0.027698 -0.016546\n50% 0.860314 -0.140885 0.231275 0.568172\n75% 1.035594 0.756874 0.538699 1.171915\nmax 1.347619 1.134061 1.259256 1.984617"
}
],
"prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.T #Transposing data",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>2013-01-01 00:00:00</th>\n <th>2013-01-02 00:00:00</th>\n <th>2013-01-03 00:00:00</th>\n <th>2013-01-04 00:00:00</th>\n <th>2013-01-05 00:00:00</th>\n <th>2013-01-06 00:00:00</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>A</th>\n <td> 1.347619</td>\n <td> 0.707768</td>\n <td> 1.012861</td>\n <td> 0.379804</td>\n <td>-0.251697</td>\n <td> 1.043172</td>\n </tr>\n <tr>\n <th>B</th>\n <td> 1.134061</td>\n <td>-0.205311</td>\n <td>-0.076460</td>\n <td>-0.415925</td>\n <td>-0.266695</td>\n <td> 1.034652</td>\n </tr>\n <tr>\n <th>C</th>\n <td> 0.211494</td>\n <td>-0.841852</td>\n <td>-0.033567</td>\n <td> 1.259256</td>\n <td> 0.634580</td>\n <td> 0.251056</td>\n </tr>\n <tr>\n <th>D</th>\n <td> 0.412057</td>\n <td>-0.159414</td>\n <td> 1.984617</td>\n <td> 0.724286</td>\n <td>-0.174819</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 18,
"text": " 2013-01-01 2013-01-02 2013-01-03 2013-01-04 2013-01-05 2013-01-06\nA 1.347619 0.707768 1.012861 0.379804 -0.251697 1.043172\nB 1.134061 -0.205311 -0.076460 -0.415925 -0.266695 1.034652\nC 0.211494 -0.841852 -0.033567 1.259256 0.634580 0.251056\nD 0.412057 -0.159414 1.984617 0.724286 -0.174819 1.321124"
}
],
"prompt_number": 18
},
{
"cell_type": "code",
"collapsed": false,
"input": "df",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 19,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819\n2013-01-06 1.043172 1.034652 0.251056 1.321124"
}
],
"prompt_number": 19
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.sort(axis=1,ascending=False) #sort by row :D C B A",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>D</th>\n <th>C</th>\n <th>B</th>\n <th>A</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>2013-01-01</th>\n <td> 0.412057</td>\n <td> 0.211494</td>\n <td> 1.134061</td>\n <td> 1.347619</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td>-0.159414</td>\n <td>-0.841852</td>\n <td>-0.205311</td>\n <td> 0.707768</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.984617</td>\n <td>-0.033567</td>\n <td>-0.076460</td>\n <td> 1.012861</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.724286</td>\n <td> 1.259256</td>\n <td>-0.415925</td>\n <td> 0.379804</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.174819</td>\n <td> 0.634580</td>\n <td>-0.266695</td>\n <td>-0.251697</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.321124</td>\n <td> 0.251056</td>\n <td> 1.034652</td>\n <td> 1.043172</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 20,
"text": " D C B A\n2013-01-01 0.412057 0.211494 1.134061 1.347619\n2013-01-02 -0.159414 -0.841852 -0.205311 0.707768\n2013-01-03 1.984617 -0.033567 -0.076460 1.012861\n2013-01-04 0.724286 1.259256 -0.415925 0.379804\n2013-01-05 -0.174819 0.634580 -0.266695 -0.251697\n2013-01-06 1.321124 0.251056 1.034652 1.043172"
}
],
"prompt_number": 20
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.sort(columns='A') #Sorting by values",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n <tr>\n <th>2013-01-01</th>\n <td> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 21,
"text": " A B C D\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-06 1.043172 1.034652 0.251056 1.321124\n2013-01-01 1.347619 1.134061 0.211494 0.412057"
}
],
"prompt_number": 21
},
{
"cell_type": "code",
"collapsed": false,
"input": "df[0:3]",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 22,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617"
}
],
"prompt_number": 22
},
{
"cell_type": "code",
"collapsed": false,
"input": "df['A'] #Selecting a single column, which yields a Series, equivalent to df.A",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 23,
"text": "2013-01-01 1.347619\n2013-01-02 0.707768\n2013-01-03 1.012861\n2013-01-04 0.379804\n2013-01-05 -0.251697\n2013-01-06 1.043172\nFreq: D, Name: A"
}
],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.A",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 24,
"text": "2013-01-01 1.347619\n2013-01-02 0.707768\n2013-01-03 1.012861\n2013-01-04 0.379804\n2013-01-05 -0.251697\n2013-01-06 1.043172\nFreq: D, Name: A"
}
],
"prompt_number": 24
},
{
"cell_type": "code",
"collapsed": false,
"input": "df['20130102':'20130104'] #Selecting via []",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 27,
"text": " A B C D\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-04 0.379804 -0.415925 1.259256 0.724286"
}
],
"prompt_number": 27
},
{
"cell_type": "code",
"collapsed": false,
"input": "df[df.A>0] #Boolean indexing",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 28,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617\n2013-01-04 0.379804 -0.415925 1.259256 0.724286\n2013-01-06 1.043172 1.034652 0.251056 1.321124"
}
],
"prompt_number": 28
},
{
"cell_type": "code",
"collapsed": false,
"input": "df[df>0]",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td> NaN</td>\n <td> NaN</td>\n <td> NaN</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td> NaN</td>\n <td> NaN</td>\n <td> 1.984617</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td> NaN</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td> NaN</td>\n <td> NaN</td>\n <td> 0.634580</td>\n <td> NaN</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 29,
"text": " A B C D\n2013-01-01 1.347619 1.134061 0.211494 0.412057\n2013-01-02 0.707768 NaN NaN NaN\n2013-01-03 1.012861 NaN NaN 1.984617\n2013-01-04 0.379804 NaN 1.259256 0.724286\n2013-01-05 NaN NaN 0.634580 NaN\n2013-01-06 1.043172 1.034652 0.251056 1.321124"
}
],
"prompt_number": 29
},
{
"cell_type": "code",
"collapsed": false,
"input": "s1 = pd.Series(np.arange(1,7),index=pd.date_range('20130102',periods=6))",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 30
},
{
"cell_type": "code",
"collapsed": false,
"input": "s1",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 31,
"text": "2013-01-02 1\n2013-01-03 2\n2013-01-04 3\n2013-01-05 4\n2013-01-06 5\n2013-01-07 6\nFreq: D"
}
],
"prompt_number": 31
},
{
"cell_type": "code",
"collapsed": false,
"input": "df['F'] = s1 #Setting a new column",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 32
},
{
"cell_type": "code",
"collapsed": false,
"input": "df",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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 <th>F</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>2013-01-01</th>\n <td> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 0.707768</td>\n <td>-0.205311</td>\n <td>-0.841852</td>\n <td>-0.159414</td>\n <td> 1</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 1.012861</td>\n <td>-0.076460</td>\n <td>-0.033567</td>\n <td> 1.984617</td>\n <td> 2</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 0.379804</td>\n <td>-0.415925</td>\n <td> 1.259256</td>\n <td> 0.724286</td>\n <td> 3</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td>-0.251697</td>\n <td>-0.266695</td>\n <td> 0.634580</td>\n <td>-0.174819</td>\n <td> 4</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 1.043172</td>\n <td> 1.034652</td>\n <td> 0.251056</td>\n <td> 1.321124</td>\n <td> 5</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 33,
"text": " A B C D F\n2013-01-01 1.347619 1.134061 0.211494 0.412057 NaN\n2013-01-02 0.707768 -0.205311 -0.841852 -0.159414 1\n2013-01-03 1.012861 -0.076460 -0.033567 1.984617 2\n2013-01-04 0.379804 -0.415925 1.259256 0.724286 3\n2013-01-05 -0.251697 -0.266695 0.634580 -0.174819 4\n2013-01-06 1.043172 1.034652 0.251056 1.321124 5"
}
],
"prompt_number": 33
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.mean()",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 34,
"text": "A 0.706588\nB 0.200720\nC 0.246828\nD 0.684642\nF 3.000000"
}
],
"prompt_number": 34
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.mean(1)",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 35,
"text": "2013-01-01 0.776308\n2013-01-02 0.100238\n2013-01-03 0.977490\n2013-01-04 0.989484\n2013-01-05 0.788274\n2013-01-06 1.730001\nFreq: D"
}
],
"prompt_number": 35
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.apply(np.cumsum) #Applying functions to the data",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stderr",
"text": "/usr/local/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/core/frame.py:3576: FutureWarning: rename with inplace=True will return None from pandas 0.11 onward\n \" from pandas 0.11 onward\", FutureWarning)\n"
},
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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 <th>F</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>2013-01-01</th>\n <td> 1.347619</td>\n <td> 1.134061</td>\n <td> 0.211494</td>\n <td> 0.412057</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>2013-01-02</th>\n <td> 2.055386</td>\n <td> 0.928750</td>\n <td>-0.630359</td>\n <td> 0.252643</td>\n <td> 1</td>\n </tr>\n <tr>\n <th>2013-01-03</th>\n <td> 3.068247</td>\n <td> 0.852290</td>\n <td>-0.663926</td>\n <td> 2.237260</td>\n <td> 3</td>\n </tr>\n <tr>\n <th>2013-01-04</th>\n <td> 3.448051</td>\n <td> 0.436365</td>\n <td> 0.595330</td>\n <td> 2.961546</td>\n <td> 6</td>\n </tr>\n <tr>\n <th>2013-01-05</th>\n <td> 3.196355</td>\n <td> 0.169669</td>\n <td> 1.229910</td>\n <td> 2.786728</td>\n <td> 10</td>\n </tr>\n <tr>\n <th>2013-01-06</th>\n <td> 4.239527</td>\n <td> 1.204322</td>\n <td> 1.480966</td>\n <td> 4.107852</td>\n <td> 15</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 36,
"text": " A B C D F\n2013-01-01 1.347619 1.134061 0.211494 0.412057 NaN\n2013-01-02 2.055386 0.928750 -0.630359 0.252643 1\n2013-01-03 3.068247 0.852290 -0.663926 2.237260 3\n2013-01-04 3.448051 0.436365 0.595330 2.961546 6\n2013-01-05 3.196355 0.169669 1.229910 2.786728 10\n2013-01-06 4.239527 1.204322 1.480966 4.107852 15"
}
],
"prompt_number": 36
},
{
"cell_type": "code",
"collapsed": false,
"input": "s = pd.Series(np.random.randint(0,7,size=10))",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 37
},
{
"cell_type": "code",
"collapsed": false,
"input": "s",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 38,
"text": "0 0\n1 4\n2 4\n3 1\n4 5\n5 3\n6 3\n7 1\n8 4\n9 6"
}
],
"prompt_number": 38
},
{
"cell_type": "code",
"collapsed": false,
"input": "s.value_counts()",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 39,
"text": "4 3\n3 2\n1 2\n6 1\n5 1\n0 1"
}
],
"prompt_number": 39
},
{
"cell_type": "code",
"collapsed": false,
"input": "df = pd.DataFrame({ 'A': ['foo', 'bar', 'foo', 'bar'],\n 'B': ['one', 'two', 'three', 'two'],\n 'C': np.random.randn(4), 'D': np.random.randn(4)})",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 40
},
{
"cell_type": "code",
"collapsed": false,
"input": "df",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\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>0</th>\n <td> foo</td>\n <td> one</td>\n <td>-0.992310</td>\n <td>-1.930488</td>\n </tr>\n <tr>\n <th>1</th>\n <td> bar</td>\n <td> two</td>\n <td> 0.856771</td>\n <td>-0.637112</td>\n </tr>\n <tr>\n <th>2</th>\n <td> foo</td>\n <td> three</td>\n <td> 1.041932</td>\n <td>-0.784131</td>\n </tr>\n <tr>\n <th>3</th>\n <td> bar</td>\n <td> two</td>\n <td> 0.953765</td>\n <td>-0.016198</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 41,
"text": " A B C D\n0 foo one -0.992310 -1.930488\n1 bar two 0.856771 -0.637112\n2 foo three 1.041932 -0.784131\n3 bar two 0.953765 -0.016198"
}
],
"prompt_number": 41
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.groupby('A').sum()",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>C</th>\n <th>D</th>\n </tr>\n <tr>\n <th>A</th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>bar</th>\n <td> 1.810536</td>\n <td>-0.653311</td>\n </tr>\n <tr>\n <th>foo</th>\n <td> 0.049622</td>\n <td>-2.714619</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 44,
"text": " C D\nA \nbar 1.810536 -0.653311\nfoo 0.049622 -2.714619"
}
],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.groupby('A').sum()",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>C</th>\n <th>D</th>\n </tr>\n <tr>\n <th>A</th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>bar</th>\n <td> 1.810536</td>\n <td>-0.653311</td>\n </tr>\n <tr>\n <th>foo</th>\n <td> 0.049622</td>\n <td>-2.714619</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 45,
"text": " C D\nA \nbar 1.810536 -0.653311\nfoo 0.049622 -2.714619"
}
],
"prompt_number": 45
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.groupby(['A','B']).sum()",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th></th>\n <th>C</th>\n <th>D</th>\n </tr>\n <tr>\n <th>A</th>\n <th>B</th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>bar</th>\n <th>two</th>\n <td> 1.810536</td>\n <td>-0.653311</td>\n </tr>\n <tr>\n <th rowspan=\"2\" valign=\"top\">foo</th>\n <th>one</th>\n <td>-0.992310</td>\n <td>-1.930488</td>\n </tr>\n <tr>\n <th>three</th>\n <td> 1.041932</td>\n <td>-0.784131</td>\n </tr>\n </tbody>\n</table>\n</div>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 48,
"text": " C D\nA B \nbar two 1.810536 -0.653311\nfoo one -0.992310 -1.930488\n three 1.041932 -0.784131"
}
],
"prompt_number": 48
},
{
"cell_type": "code",
"collapsed": false,
"input": "rng = pd.date_range('3/6/2012',periods=100,freq='S')",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 49
},
{
"cell_type": "code",
"collapsed": false,
"input": "rng",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 50,
"text": "<class 'pandas.tseries.index.DatetimeIndex'>\n[2012-03-06 00:00:00, ..., 2012-03-06 00:01:39]\nLength: 100, Freq: S, Timezone: None"
}
],
"prompt_number": 50
},
{
"cell_type": "code",
"collapsed": false,
"input": "ts = pd.Series(np.random.randint(0,500,len(rng)),index=rng)",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 51
},
{
"cell_type": "code",
"collapsed": false,
"input": "ts.resample('5Min',how='sum')",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 52,
"text": "2012-03-06 27517\nFreq: 5T"
}
],
"prompt_number": 52
},
{
"cell_type": "code",
"collapsed": false,
"input": "ts = pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2013',periods=1000))",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 53
},
{
"cell_type": "code",
"collapsed": false,
"input": "ts = ts.cumsum()",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 54
},
{
"cell_type": "code",
"collapsed": false,
"input": "ts",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 55,
"text": "2013-01-01 1.487238\n2013-01-02 3.126100\n2013-01-03 3.266453\n2013-01-04 3.596608\n2013-01-05 1.954514\n2013-01-06 2.678160\n2013-01-07 2.592938\n2013-01-08 3.510866\n2013-01-09 4.189961\n2013-01-10 5.576922\n2013-01-11 7.332226\n2013-01-12 7.615352\n2013-01-13 7.071786\n2013-01-14 5.798881\n2013-01-15 5.111172\n...\n2015-09-13 -14.895017\n2015-09-14 -14.859396\n2015-09-15 -13.228886\n2015-09-16 -12.860943\n2015-09-17 -13.450452\n2015-09-18 -13.857490\n2015-09-19 -14.720689\n2015-09-20 -12.916550\n2015-09-21 -13.290012\n2015-09-22 -13.991150\n2015-09-23 -13.344230\n2015-09-24 -13.019405\n2015-09-25 -11.829843\n2015-09-26 -10.809247\n2015-09-27 -9.743599\nFreq: D, Length: 1000"
}
],
"prompt_number": 55
},
{
"cell_type": "code",
"collapsed": false,
"input": "from pylab import *\nts.plot()",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 56,
"text": "<matplotlib.axes.AxesSubplot at 0x37b01d0>"
}
],
"prompt_number": 56
},
{
"cell_type": "code",
"collapsed": false,
"input": "df = pd.DataFrame(np.random.randn(1000,4),index=ts.index,columns=['A','B','C','D'])\n ",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 57
},
{
"cell_type": "code",
"collapsed": false,
"input": "df = df.cumsum()",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 58
},
{
"cell_type": "code",
"collapsed": false,
"input": "import matplotlib.pylab as plt",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 59
},
{
"cell_type": "code",
"collapsed": false,
"input": "plt.figure(); df.plot();plt.legend(loc='best')",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 60,
"text": "<matplotlib.legend.Legend at 0x37e9b50>"
}
],
"prompt_number": 60
},
{
"cell_type": "code",
"collapsed": false,
"input": "df.to_csv('foo.csv')",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 61
},
{
"cell_type": "code",
"collapsed": false,
"input": "pd.read_csv('foo.csv')",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 62,
"text": "<class 'pandas.core.frame.DataFrame'>\nInt64Index: 1000 entries, 0 to 999\nData columns:\nUnnamed: 0 1000 non-null values\nA 1000 non-null values\nB 1000 non-null values\nC 1000 non-null values\nD 1000 non-null values\ndtypes: float64(4), object(1)"
}
],
"prompt_number": 62
},
{
"cell_type": "code",
"collapsed": false,
"input": "s = pd.date_range('1/1/2013',periods=10) #without specifying freq = 'S' OR 'D' OR 'M'",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 63
},
{
"cell_type": "code",
"collapsed": false,
"input": "s",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 64,
"text": "<class 'pandas.tseries.index.DatetimeIndex'>\n[2013-01-01 00:00:00, ..., 2013-01-10 00:00:00]\nLength: 10, Freq: D, Timezone: None"
}
],
"prompt_number": 64
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment