def get_reshaped_dfs(): dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa = reshape_a(dfa) dfq = reshape_q(dfq) dfm = reshape_m(dfm) return dfa, dfq, dfm
def db2xl(): dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa = reshape_a(dfa) dfq = reshape_q(dfq) dfm = reshape_m(dfm) write_to_xl(dfa, dfq, dfm) write_to_csv(dfa, dfq, dfm)
# TODO 6 - Write a sheet with varnames # TODO 7 - Check its complete def db2xl(): dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa = reshape_a(dfa) dfq = reshape_q(dfq) dfm = reshape_m(dfm) write_to_xl(dfa, dfq, dfm) write_to_csv(dfa, dfq, dfm) if __name__ == "__main__": dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa, dfq, dfm = reshape_all(dfa, dfq, dfm) write_to_xl(dfa, dfq, dfm) for y in df_csv_iter(dfa): print(y) # note- order on columns i lost, a-betic # 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.
def get_var_list(): dfa, dfq, dfm = read_dfs() dfa = reshape_a(dfa) return dfa.columns.values.tolist()
# TODO 5 - Also write this to Excel xls/xlsx too as sheets # TODO 6 - Write a sheet with varnames # TODO 7 - Check its complete def db2xl(): dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa = reshape_a(dfa) dfq = reshape_q(dfq) dfm = reshape_m(dfm) write_to_xl(dfa, dfq, dfm) write_to_csv(dfa, dfq, dfm) if __name__ == "__main__": dfa, dfq, dfm = read_dfs() check_for_dups(dfa) dfa, dfq, dfm = reshape_all(dfa, dfq, dfm) write_to_xl(dfa, dfq, dfm) for y in df_csv_iter(dfa): print(y) # note- order on columns i lost, a-betic #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.