Use Enthought Canopy outside of their environment

From hints on their blog and other places: Canopy installs a virtual environment. The environment activate command is located at ~/Library/Enthought/Canopy_64bit/User/bin/activate. An easy way to access this environment is to alias it in your start up file eg: # For canopy ipythonalias canpy=’source ~/Library/Enthought/Canopy_64bit/User/bin/activate’ When in the environment use deactivate to exit. I’m using Canopy… Read More Use Enthought Canopy outside of their environment

Each access of a Pandas hdf5 store node is a re-copy from the file

This is obvious, but it is important to remember. import pandas as pd, pylab, cProfiledef create_file(): r = pylab.randn(10000,1000) p = pd.DataFrame(r) with pd.get_store(‘test.h5′,’w’) as store: store[‘data’] = pdef analyze(p): return [(p[c] > 0).size for c in [0,1,2,3,4,5,6,7,8,9]]def copy1(): print ‘Working on copy of data’ with pd.get_store(‘test.h5′,’r’) as store: p = store[‘data’] idx = analyze(p)… Read More Each access of a Pandas hdf5 store node is a re-copy from the file

Pandas: presence of a NaN/None in a DataFrame forces column to float

import pandas as pda = [[1,2],[3,4]]df = pd.DataFrame(a)df-> 0 10 1 21 3 4df.values ->array([[1, 2], [3, 4]])df.ix[1].values ->array([3, 4])a = [[1,None],[3,4]]df = pd.DataFrame(a)df-> 0 10 1 NaN1 3 4df.values ->array([[ 1., nan], [ 3., 4.]])df[0].values ->array([1, 3])df[1].values ->array([ nan, 4.])df.ix[1].values ->array([ 3., 4.])df[0][1] -> 3df[1][1] -> 4.0 This threw me because I have a… Read More Pandas: presence of a NaN/None in a DataFrame forces column to float