使用streamlit写报告

本文介绍如何利用python的streamlit库制作可以根据数据变化自动更新的报告,对比了streamlit与reportlab,并展示了如何定义文字样式和图表。
摘要由CSDN通过智能技术生成

这里写自定义目录标题

前言

最近在研究用python写报告,最主要可以根据数据的变化自动修改文字和图表,省下很多事,对比了市面上工具,能够自定义主题的只发现reportlab和streamlit,reportlab只能保存为pdf,streamlit则显示为网页形式,可以自己另存为pdf。

引入模块

import streamlit as st
from streamlit.components.v1 import html
from datetime import datetime
import pandas as pd
from pyecharts.charts import Line, Bar, Grid, Pie
from pyecharts.globals import CurrentConfig
from pyecharts import options as opts
import streamlit_echarts
from pyecharts.commons.utils import JsCode
import numpy as np

我使用了streamlitpyechartsstreamlit_echarts模块。

文字部分

def write_bold(text):
    st.markdown(
        '<p style="font-family:华文仿宋;font-size: 16pt;font-weight:bold;text-indent: 2em;line-height: 25pt;color: #000">%s</p>'
        % text,
        unsafe_allow_html=True)

def write(text):
    st.markdown
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值