Replies: 1 comment
-
|
I made my own script, but if there's a native way to do such things I'll be happy to know. My script: @Sheet.api
def addcol_cumsum(sheet: Sheet, column: Column) -> None:
"""Add column with cumulative sum of values in current column."""
getter = lambda c, row: sum(c.sourceCol.getValues(sheet.rows[:sheet.rows.index(row)+1]))
cumsum_column = Column(f'{column.name}_cumsum', type=column.type, getter=getter)
cumsum_column.sourceCol = column
sheet.addColumnAtCursor(cumsum_column)
Sheet.addCommand('Ins =', 'addcol-cumsum', 'addcol_cumsum(cursorCol)',
'add column with cumulative sum of current column') |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to make a column that's a cumulative sum of another column. I'm assuming I should make a "derivative column" but the docs don't make it clear how to access items of other columns that are on preceding rows. Is this possible without creating my own script?
Beta Was this translation helpful? Give feedback.
All reactions