def export_report(source, columns, title): #htmlfile = "/home/ubuntu/web/report/%s_%s.html" % (title, today.strftime("%Y%m%d"),) htmlfile = "/home/ubuntu/web/bin/index.html" outputfile = "%s/finance_report_%s.csv" % (commondatadef.resultPath, today.strftime("%Y%m%d"),) dest = source.sort_values(["rate_inc"], ascending=False) dest.drop_duplicates(inplace=True) dest.to_csv(outputfile, encoding='utf-8', index=False, float_format = '%.2f') c2h.csv2html(outputfile, htmlfile, title, columns)
def signal_handler_html(signal, frame): print('Ctrl+C to exit!') t = csv2html() t.write_html('log_ion_heap.csv', 'ION_HEAP', 'log_ion_heap.html') sys.exit(0)
def signal_handler_html(signal, frame): print('Ctrl+C to exit!') t = csv2html() t.write_html('log_ion_heap.csv', 'ION_HEAP','log_ion_heap.html') sys.exit(0)
def export_report(source, columns, title): htmlfile = "/home/ubuntu/web/%s_%s.html" % ( title, today.strftime("%Y%m%d"), ) outputfile = "%s/finance_report_%s.csv" % ( commondatadef.resultPath, today.strftime("%Y%m%d"), ) dest = source.sort_values(["code"]) dest.drop_duplicates(inplace=True) dest.to_csv(outputfile, encoding='utf-8', index=False) c2h.csv2html(outputfile, htmlfile, title, columns)
from sys import argv import os from os.path import isfile from csv2html import csv2html import ssconverter if len(argv) == 3: input = argv[1] output = argv[2] else: print "Please supply two arguments, like so:\npython sheet2table.py input.odf output.html" exit(255) if not isfile(input): print "%s not found. Please provide a valid file path." % input exit(1) if isfile (output): Yn = raw_input("%s already exists. This operation will overwrite that file. Do you want to continue? Y/n\n> " % output) if Yn == 'Y': print "Creating %s..." % output else: print "Canceling operation..." exit(1) converter = ssconverter.SSConverter() converter.convert(input, "HXz1SYGU.csv") csv2html("HXz1SYGU.csv", output) os.remove("HXz1SYGU.csv")
totalAssets,总资产(万) liquidAssets,流动资产 fixedAssets,固定资产 reserved,公积金 reservedPerShare,每股公积金 esp,每股收益 bvps,每股净资 pb,市净率 timeToMarket,上市日期 undp,未分利润 perundp, 每股未分配 rev,收入同比(%) profit,利润同比(%) gpr,毛利率(%) npr,净利润率(%) holders,股东人数 ''' columns = {} columns['name'] = [ 'code', 'name', 'industry', 'area', 'pe', 'outstanding', 'totals', 'totalAssets', 'liquidAssets', 'fixedAssets', 'reserved', 'reservedPerShare', 'esp' ] columns['index'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] htmlfile = "/home/ubuntu/web/finance_report_%s.html" % ( today.strftime("%Y%m%d"), ) c2h.csv2html(outputfile, htmlfile, "股票列表", columns)