Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (37 sloc) 1.029 kB
from pandas import *
from pandas.util.testing import rands
N = 1000
K = 50
def _random_index(howmany):
return Index([rands(10) for _ in xrange(howmany)])
df = DataFrame(np.random.randn(N, K), index=_random_index(N),
columns=_random_index(K))
def get1():
for col in df.columns:
for row in df.index:
_ = df[col][row]
def get2():
for col in df.columns:
for row in df.index:
_ = df.get_value(row, col)
def put1():
for col in df.columns:
for row in df.index:
df[col][row] = 0
def put2():
for col in df.columns:
for row in df.index:
df.set_value(row, col, 0)
def resize1():
buf = DataFrame()
for col in df.columns:
for row in df.index:
buf = buf.set_value(row, col, 5.)
return buf
def resize2():
from collections import defaultdict
buf = defaultdict(dict)
for col in df.columns:
for row in df.index:
buf[col][row] = 5.
return DataFrame(buf)
Jump to Line
Something went wrong with that request. Please try again.