forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: support Styler in ExcelFormatter
closes pandas-dev#1663 Author: Joel Nothman <joel.nothman@gmail.com> Closes pandas-dev#15530 from jnothman/excel_style and squashes the following commits: c7a51ca [Joel Nothman] Test currently fails on openpyxl1 due to version incompatibilities 836f39e [Joel Nothman] Revert changes to xlwt de53808 [Joel Nothman] Remove debug code a5d51f9 [Joel Nothman] Merge branch 'master' into excel_style 934df06 [Joel Nothman] Display df, not styled 6465913 [Joel Nothman] More pytest-like test_styler_to_excel; enhancements to xlwt 6168765 [Joel Nothman] Recommended changes to what's new 9669d7d [Joel Nothman] Require jinja in test with df.style 14035c5 [Joel Nothman] Merge branch 'master' into excel_style 3071bac [Joel Nothman] Complete tests ceb9171 [Joel Nothman] reasons for xfails e2cfa77 [Joel Nothman] Test Styler.to_excel d5db0ac [Joel Nothman] Remove obsolete TODO 0256fc6 [Joel Nothman] Return after unhandled font size warning 60d6a3b [Joel Nothman] add doc/source/styled.xlsx to the gitignore 4e72993 [Joel Nothman] Fix what's new heading d144fdf [Joel Nothman] Font name strings 61fdc69 [Joel Nothman] Complete testing basic CSS -> Excel conversions 6ff8a46 [Joel Nothman] Fix loose character; sorry 6d3ffc6 [Joel Nothman] Lint 79eae41 [Joel Nothman] Documentation tweaks c4f59c6 [Joel Nothman] Doc tweaks 2c3d015 [Joel Nothman] Fix JSON syntax in IPynb b1d774b [Joel Nothman] What's new heading 096f26c [Joel Nothman] Merge remote-tracking branch 'upstream/master' into excel_style 433be03 [Joel Nothman] Documentation 9a62699 [Joel Nothman] Fix tests and add TODOs to tests 7c54a69 [Joel Nothman] Fix test failures; avoid hair border which renders strangely 8e9a567 [Joel Nothman] Fixes from integration testing c1fc232 [Joel Nothman] Remove debugging print statements a43d6b7 [Joel Nothman] Cleaner imports a1127f6 [Joel Nothman] Merge branch 'master' into excel_style 306eebe [Joel Nothman] Module-level docstring 350eab5 [Joel Nothman] remove spurious blank line efce9b6 [Joel Nothman] More CSS to Excel testing; define ExcelFormatter.write f17a0f4 [Joel Nothman] Some border style tests 1a8818f [Joel Nothman] Lint 9a5b791 [Joel Nothman] Fix testing ImportError 1984cab [Joel Nothman] Fix making get_level_lengths non-private eb02cc1 [Joel Nothman] Fix testing ImportError 3b26087 [Joel Nothman] Make get_level_lengths non-private f62f02d [Joel Nothman] File restructure dc953d4 [Joel Nothman] Font size and border width 7db59c0 [Joel Nothman] Test inherited styles in converter d103f61 [Joel Nothman] Refactoring and initial tests for CSS to Excel 176e51c [Joel Nothman] Fix NameError c589c35 [Joel Nothman] Fix some lint errors (yes, the code needs testing) cb5cf02 [Joel Nothman] Fix bug where inherited not being passed; avoid classmethods 0ce72f9 [Joel Nothman] Use inherited font size for em_pt 8780076 [Joel Nothman] Merge branch 'master' into excel_style 96680f9 [Joel Nothman] Largely complete CSSToExcelConverter and Styler.to_excel() f1cde08 [Joel Nothman] FIX column offset incorrect in refactor ada5101 [Joel Nothman] ENH: support Styler in ExcelFormatter
- Loading branch information
Showing
13 changed files
with
1,670 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Common helper methods used in different submodules of pandas.io.formats | ||
""" | ||
|
||
|
||
def get_level_lengths(levels, sentinel=''): | ||
"""For each index in each level the function returns lengths of indexes. | ||
Parameters | ||
---------- | ||
levels : list of lists | ||
List of values on for level. | ||
sentinel : string, optional | ||
Value which states that no new index starts on there. | ||
Returns | ||
---------- | ||
Returns list of maps. For each level returns map of indexes (key is index | ||
in row and value is length of index). | ||
""" | ||
if len(levels) == 0: | ||
return [] | ||
|
||
control = [True for x in levels[0]] | ||
|
||
result = [] | ||
for level in levels: | ||
last_index = 0 | ||
|
||
lengths = {} | ||
for i, key in enumerate(level): | ||
if control[i] and key == sentinel: | ||
pass | ||
else: | ||
control[i] = False | ||
lengths[last_index] = i - last_index | ||
last_index = i | ||
|
||
lengths[last_index] = len(level) - last_index | ||
|
||
result.append(lengths) | ||
|
||
return result |
Oops, something went wrong.