Checks the right environment is being used and one of the data science modules is installed
import sys
import IPython
print(sys.executable)
print(sys.version)
/Users/chrisralbon/anaconda/envs/py3k/bin/python 3.3.5 |Anaconda 2.1.0 (x86_64)| (default, Sep 2 2014, 13:57:31) [GCC 4.2.1 (Apple Inc. build 5577)]
IPython.__version__
'2.2.0'
import numpy as np
arr = np.arange(100)
arr
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99])
import pandas as pd
df = pd.DataFrame(np.random.randn(8, 3),
index=pd.date_range('1/1/2000', periods=8),
columns=['A', 'B', 'C'])
df
A | B | C | |
---|---|---|---|
2000-01-01 | 0.941488 | 1.325088 | -2.251415 |
2000-01-02 | -0.031463 | -0.342263 | -0.255721 |
2000-01-03 | 0.180192 | -0.236305 | 0.135585 |
2000-01-04 | -2.088548 | 1.204635 | 0.916760 |
2000-01-05 | -0.461350 | -1.350354 | -0.261618 |
2000-01-06 | -0.130376 | 1.732998 | 0.301640 |
2000-01-07 | -0.781489 | 0.738901 | -0.289822 |
2000-01-08 | 0.295216 | -0.610543 | -1.941927 |
df[0:4]
A | B | C | |
---|---|---|---|
2000-01-01 | 0.941488 | 1.325088 | -2.251415 |
2000-01-02 | -0.031463 | -0.342263 | -0.255721 |
2000-01-03 | 0.180192 | -0.236305 | 0.135585 |
2000-01-04 | -2.088548 | 1.204635 | 0.916760 |