INNER CODE UNIT · Python

explore_data

featurestoreorg/serverless-ml-course · src/04-module/cc-fraud-streamlit-ui.py:56

def explore_data(batch_data):
    st.write(36 * "-")
    print_fancy_header('\n👁 Data Exploration...')
    labels = ["Suspected of Fraud", "Not Suspected of Fraud"]
    unique, counts = np.unique(batch_data.fraud.values, return_counts=True)
    values = counts.tolist()

    def plot_pie(values, labels):
        fig = px.pie(values=values, names=labels, title='Distribution of predicted fraud transactions')
        return fig

    fig1 = plot_pie(values, labels)
    st.plotly_chart(fig1)


def print_fancy_header(text, font_size=24):
    res = f'<span style="color:#ff5f27; font-size: {font_size}px;">{text}</span>'
    st.markdown(res, unsafe_allow_html=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…