python - Memory error when using Pandas built-in divide, but looping works? -
i have 2 dataframes, each having 100,000 rows. trying following:
new = dataframea['mykey']/dataframeb['mykey']
and 'out of memory' error. same error if try:
new = dataframea['mykey'].divide(dataframeb['mykey'])
but if loop through each element, this, works:
result = [] idx in range(0,dataframea.shape[0]): result.append(dataframea.ix[idx,'mykey']/dataframeb.ix[idx,'mykey'])
what's going on here? i'd think built-in pandas functions more memory efficient.
@ayhan got right off bat.
my 2 dataframes not using same indices. resetting them worked.
Comments
Post a Comment