Created
          January 14, 2013 04:55 
        
      - 
      
- 
        Save pasunboneleve/4527849 to your computer and use it in GitHub Desktop. 
    Code for generating colours list for use with xlwt. In XLS format, of course ;7)
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | # -*- coding: utf-8 -*- | |
| """ | |
| Created on Mon Jan 14 15:36:36 2013 | |
| @author: daniel.vianna | |
| """ | |
| import xlwt as xlwt | |
| import pandas as pd | |
| conv = pd.io.parsers.CellStyleConverter() | |
| wb = xlwt.Workbook() | |
| ws = wb.add_sheet('sheet') | |
| def stylefunc(i): | |
| styledict = {"pattern": {"pattern": "solid", "fore_colour": i}} | |
| return conv.to_xls(styledict) | |
| [ws.row(i).write(0,i,stylefunc(i)) for i in range(100)] | |
| wb.save('colours.xls') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment