epogrebnyak / data-rosstat-kep

Time series dataset of Rosstat Short-term Economic Indicators ("KEP") publication
http://www.gks.ru/wps/wcm/connect/rosstat_main/rosstat/ru/statistics/publications/catalog/doc_1140080765391
6 stars 6 forks source link

Pretty formatting of output .xls file #1

Open epogrebnyak opened 9 years ago

epogrebnyak commented 9 years ago

Input:

Output:

Interface function:

reformat_xls(datasource_file = '_kep.xls', format_file = '_kep-format.xls', 
                                                           output_file = 'kep.xls') 

Behaviour:

From first sheet of format file '_kep-format.xls' read format of first n (n=3) rows. Apply formatting to n rows in new file. Apply n-th row format to all other rows. Intent: apply formatting of headers to headers and formatting of rows to row.

Links:

epogrebnyak commented 8 years ago

Less sophisticated approach, just change cell fornmatting in column A

epogrebnyak commented 8 years ago

TODO: may change formatting of the columns http://xlsxwriter.readthedocs.org/en/latest/example_pandas_column_formats.html#ex-pandas-column-formats http://stackoverflow.com/questions/17069694/writing-xlwt-dates-with-excel-date-format http://stackoverflow.com/questions/9920935/easily-write-formatted-excel-from-python-start-with-excel-formatted-use-it-in

do not write second row - inherited from pivot.

epogrebnyak commented 8 years ago

column in 'variables' sheet in kep.xls(x) need more width

epogrebnyak commented 8 years ago

See https://github.com/epogrebnyak/rosstat-806-regional/issues/21

epogrebnyak commented 8 years ago

Use code from here in here for better xls(x) file formatting.

Changes above work for just one file type (xls or xlsx) - do not remember, other one will be the same default styles.

Fak3 commented 8 years ago

Task copied from commit comments:

epogrebnyak commented 8 years ago

in kep.xlsx the first row has new formatting, but first column in formatted wrong:

image

epogrebnyak commented 8 years ago

@Fak3 - please move this work to a new branch, and revert commits related to this problem in master

Fak3 commented 8 years ago

moved to pretty_xlsx branch

Fak3 commented 8 years ago

in kep.xlsx the first row has new formatting, but first column in formatted wrong

First column on your screenshot is formatted exactly as written in the code. What is wrong?

            'bold': True,
            'font_name': 'Arial',
            'font_size': 10,
            'align': 'center',
            'border': 1
epogrebnyak commented 8 years ago

First column must be "YYYY-MM-DD", in date format