0

I have an SFrame with multiple columns like 'measure1','measure2','measure3',..

I'd like to add a new column 'total_measure' with the totals of measure1 + measure2 + measure3 etc.

I thought this would to the job: cdss_analysis.unstack(column=['measure1','measure2'],new_column_name='total_measure')

But that doesn't seem to be correct.

dsent
  • 305
  • 1
  • 3
  • 9

1 Answers1

0

If 'measure1', 'measure2', etc are already in separate columns, there's no need to unpack the values. If this is the case, the "+" operator should do the trick:

import graphlab
sf = graphlab.SFrame({'measure1': [1, 1, 2], 'measure2': [4, 1, 3]})
sf['total'] = sf['measure1'] + sf['measure2']
papayawarrior
  • 1,027
  • 7
  • 10