Skip to content

Commit

Permalink
Add include_columns and include_index kwargs to ArrayFormula.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyroberts committed Apr 28, 2015
1 parent fcfa951 commit 27eef34
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions xltable/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ class ArrayFormula(Table):
:param int width: Number of columns.
:param int height: Number of row.
:param pandas.DataFrame value: Precalculated formula result to save in the workbook.
:param bool include_columns: Include the column names when outputting `value`.
:param bool include_index: Include the index when outputting `value`.
:param xltable.TableStyle style: Table style, or one of the named styles 'default' or 'plain'.
:param xltable.CellStyle column_styles: Dictionary of column names to styles or named styles.
:param float column_widths: Dictionary of column names to widths.
Expand All @@ -255,6 +257,8 @@ def __init__(self,
width,
height,
value=None,
include_columns=False,
include_index=False,
style="default",
column_styles={},
column_widths={}):
Expand All @@ -264,12 +268,12 @@ def __init__(self,
df = value
self.value = value
super(ArrayFormula, self).__init__(name,
dataframe=df,
include_columns=False,
include_index=False,
style=style,
column_styles=column_styles,
column_widths=column_widths)
dataframe=df,
include_columns=include_columns,
include_index=include_index,
style=style,
column_styles=column_styles,
column_widths=column_widths)

@property
def formula(self):
Expand All @@ -278,5 +282,4 @@ def formula(self):
def get_data(self, workbook, row, col):
if not self.value:
self.dataframe[:] = "{%s}" % self.formula.get_formula(workbook, row, col)

return super(ArrayFormula, self).get_data(workbook, row, col)

0 comments on commit 27eef34

Please sign in to comment.