Excelfancy
State: closed

adds to export dataframe for excel:
     - multiindex (merge cells similar to htmlformatter)
     - border
     - bold header
     - ability to add dataframe in same sheet (startrow, startcol)

http://cl.ly/image/2r102L0E1l23

solves Issue #2294


Labels:

Comments:
Oh that's very nice. Would you might sprinkling in some test cases?

+1

cool. sure I tried to add but ./test_fast.h

```
======================================================================
ERROR: Failure: ImportError (C extensions not built: if you installed already verify that you are not importing from the source directory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/local/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/local/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/locojay/Documents/Dev/github/pandas/pandas/__init__.py", line 16, in <module>
    raise ImportError('C extensions not built: if you installed already '
ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
```

not sure if related to the osx build issue which was solved over weekend

try building the extensions in place : `python setup.py build_ext --inplace`

Shortcut for that is `make tseries`

thanks works  wil add some tests

- all frame test are green
- excel export looks like html export when dealing with index_labels (not in same row as columns)
- small fix to reader, functionality to deal with new index label style

What is missing is to add to the Reader the functionality to read multindex columns (pivot dumps....). Maybe a feature for the future

Great, thanks. I'll go ahead and merge this-- if you get a chance to write some docs, go for it in a new PR

There are test failures in this on my machine. I'll hack it to work-- just checking you ran all ~2600 tests from test_fast.sh? (or `nosetests pandas`)

was just running nosetests -s pandas.tests.test_frame apologies
I get 2 fails: 
pandas.stats.tests.test_ols.TestOLS (not sure if related)
pandas.tests.test_panel.TestPanel:test_to_excel. 

This one is due to the handling of the Excel Reader when dealing with index labels :

The new dump does it like the HTML dumper and offset by 1 row if an index has a label. 
I assumed that if a row has no values in the columns its an indexname... 
Any thoughts one what would be a good way to deal with this so one can handle parsing frames having no index label but an empty first value row? add an argument to the parser (has_indexname?), check type of column if first element is different must be an indexname

- added argument has_index_labels to the reader to handle index_labels not in the same row as the column header.
- people using the parser don't need to add any argument if they have files dumped in the previous layout.
- for the new layout (index labels offseted by one row) one needs to add has_index_labels=True
- all but one tests passes when running `nosetets pandas`. This is unrelated has it occurs in master (fbd77d5) (pandas.stats.tests.test_ols.TestOLS:testWLS) 

Thanks a ton. You can get rid of that error by upgrading to the latest development version of statsmodels

great thanks all green now

If you get a chance to write some documentation (look in `docs/source`), that'd be great!

@wesm, Looks like `xlwt` was introduced as a hard dependency, `xlwt` doesn't install on python3,
and the port to python3  `xlwt3` is abandonware. release-blocker?

So there seems to be a bug in openpyxl 1.5.8 where the cell styles don't get read in correctly but they do get written correctly still.

Just wanted to say that although the original posters screenshot (though missing the right border of the last column header) looks alright, it shouldn't mean that everyone else be forced to use his style preference.

I would request that the default output be changed back the way it has been, and an additional to_excel parameter be added for those who wish to use this style preference. I don't want my output formatted this way.