Exemplo n.º 1
0
def main(n, *args):
    n = n or 1
    filename = OUTPUT_DIR + 'frame_{0}.csv'
    ppt = PPT()
    for i in range(n):
        data = np.array(np.random.randint(0, 100, (3, 4)))
        columns = ['A', 'B', 'C', 'D']
        index = ['Row 1', 'Row 2', 'Row 3']
        frame = pd.DataFrame(data, index=index, columns=columns, dtype=int)
        frame /= 100
        out = filename.format(i + 1)
        try:
            frame.to_csv(out)
            print(f'frame exported as {out}')
        except OSError as e:
            print(f'OSError writing to {out}, this file will not be produced!')
        ppt.add_frame(frame)
        print(f'Added frame {i+1} to PPT_Creator')
    pres = ppt.create()
    pres_path = OUTPUT_DIR + 'presentation.pptx'
    pres.save(pres_path)
    print(f'Exported to {pres_path}')